Consulting

Results 1 to 2 of 2

Thread: VBA Check Box

  1. #1
    VBAX Newbie
    Joined
    Feb 2010
    Posts
    1
    Location

    VBA Check Box

    Hi,
    I work for an educational charity and we have had a VBA Database designed for us to store our data.
    One of the cpabilities of the DB is exporting data using various functions and commands. However, some of the coding for one of the check boxes in the database is incorrect. Currently, the checkbox references a prebuilt query (SchoolRecordProgrammes) looking up a child's dropout status in SchoolDroppedOut column. So if there is a value in the column the box is checked if not it remains unchecked. However, what it should do is check the value, if it is not equal to 1 or 4 then check the box, otherwise don't... Can this be done? Below is the code that is relevant for the checkbox, specifically the IIF command:

    strSQL = strSQL & _
    "WHERE qrySchoolRecordProgrammes.SchoolIDX IN (" & trSelectedSchools & ")" & _
    " AND qrySchoolRecordProgrammes.FormIDX IN (" & strSelectedForms ")" & _
    " AND qrySchoolRecordProgrammes.SchoolYear IN (" & strSelectedSchoolYears & ")" & _
    " AND qrySchoolRecordProgrammes.EventIDX IN (" & strSelectedEP & ")" & _
    " AND " & IIf(chkDroppedOut, "", "NOT ") & _
    " ( qrySchoolRecordProgrammes.SchoolDroppedOut = 3 OR " & _
    " qrySchoolRecordProgrammes.SchoolDroppedOut = 255 ) " & _

    Cheers,

    Dan

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Are you saying that if some value is 1-4 then include that instead of checking whether the checkbox is positive? If so, what value?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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