How to Use the In Operator in Query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bullfrog83
    New Member
    • Apr 2010
    • 124

    How to Use the In Operator in Query?

    I have a query in which I parameterized a column (CodeCommitteeI d). Because more than one committee can be selected I'm using the In operator. So, in the criteria line of the CodeCommitteeId column I have the following:

    Code:
    In ([Forms]![f_ParamCommittees]![txtCommitteeList])
    However, when I run the query if I enter 1,2 as the parameter value, I get no results. But if I enter only one number I get results. Why is the In not working?
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Have you tried replacing the , with a ;? The regional settings get me constantly....

    Comment

    • bullfrog83
      New Member
      • Apr 2010
      • 124

      #3
      Yeah, but that doesn't work. I get errors.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You can't pass "1,2" into a parameter and expect it to work. In expects parameters but that only passes a string. You can't pass an array of parameters that way. You will need to build the SQL in code.

        Comment

        Working...