Results 1 to 3 of 3

Thread: Basic code help1!!!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Unhappy Basic code help1!!!

    I am a complete noob so at vba so can you help make these psudocode into a vba code thanks.

    Public function MostImpPupilID()
    Initialise high score to 0
    Initialise Low score to 21
    Initialise score difference to 0



    Connect Pupil and scores tables to recordsets
    Find the first pupil in the pupil in the pupil’s recordset with the required year group

    If no student found in the year group
    Display error message
    Else
    Loop until no matching pupil in year group found
    Find the first result matching the current pupil id
    If no student result found
    Display error message
    Else
    Loop until no more result for current pupil is found
    If result is higher than the highest sciore
    Ser highest score to result
    End if
    Find next result for the Current pupil
    Loop
    If highest score – lowest score is > previous score difference
    Set previous score difference to highest score – lowest score
    Set MostImpStudentID to current student ID
    Reset highest score to 0
    Reset lowest score to 21
    End if
    End if
    Find next pupil in the current year group
    Loop
    End if
    End function

    Public function BestAvePupilid()
    Declare rspupil As Recordset
    Declare rsScore As Recodset
    Start with the total score value of 0
    Start with a counter value of 0
    Connect rsPupil to tbl_pupil_information
    Connect rsScore to tbl_test_information


    Find the first pupil in the rsPupil with the required year group
    If no pupil found in the year group
    Display error message
    Else
    Loop until no matching pupils in year group found
    Find the first result matching the current pupil id
    If no pupil result found
    Display error message
    Else
    Loop until current pupil ID is not found in result
    Add test result to total
    Add one to counter
    Loop
    End if
    Find next result for current pupil
    Divide the total score by the counter
    If the current average is higher than the previous average
    Set the previous average score to the current average
    Set BestaAvePupilId to current pupil ID
    Reset the total score to 0
    Reset the total score to 0
    Ed if
    Fin the next pupil in the required year group
    Loop
    End if
    End function
    Last edited by SamT; 03-05-2014 at 07:38 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •