Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Apr 2008
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expression builder in a query

    I am using the following criteria in a query:

    Like "*" & [] & "*"

    I would like to put the follwing code in criteria between the [ ]

    [ Forms![frmStudentActivitiesEnrollment]![cboClass]

    I can not get the combination of brackets so that the criteria can work.

    Something like this:

    Like "*" & [[ Forms![frmStudentActivitiesEnrollment]![cboClass]] & "*"

    But this does not work.

    Any ideas?

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Does this work? Why did you have two lots of Brackets around the expression?

    Code:
    Like "*" & [Forms![frmStudentActivitiesEnrollment]![cboClass] & "*"
    Regards
    John



  3. #3
    2 Star Lounger
    Join Date
    Apr 2008
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I get an improper bracketing message with your code.

    Let me explain what I am trying to do. Sample attached.
    I have three fields in a table - Activity1, Activity2 and Activity3.
    In a query I combine all the contents of the three fields into one field - AllActivities
    Using the Like criteria I am trying to determine how many records contain printmaking as one of the entries is any of the three Activity fields.
    After I have that info I can then count how many people have signed up for each activity.

    The current query works if you type in the activity. I want to be able to chose it from a dropdown menu.

    Thanks.

    Paul
    Attached Files Attached Files

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    I have just noticed a bracket missing in what I posted , after Forms.

    Like "*" & [Forms]![frmStudentActivitiesEnrollment]![cboClass] & "*"
    Regards
    John



  5. #5
    2 Star Lounger
    Join Date
    Apr 2008
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks so much.

    Paul

Posting Permissions

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