Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002
    Location
    Oakland, CA
    Posts
    126

    Unanswered: Dialog Box in a query

    Hopefully a simple answer here. How do I build a message box for my query that will limit the query to item(s) that are inputted in the message box. I know how to do it when there is a finite number of items. But what about if I don't know whether the user wants to limit the query to 1, 2 or 24 items.

    Example: Let's say I have a field MONT that takes January, February, etc. as a value.
    Now user A want to query for January and July
    User B, though, wants to query for February, March, September, and December.

    How would you built such CRITERIA? If I knew the user always wants for example 4 months then I can do it otherwise I have no clue

  2. #2
    Join Date
    Nov 2002
    Location
    Oakland, CA
    Posts
    126
    If I have to use VBA, please feel free to let me know...

  3. #3
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    use IN

    SELECT * FROM myTable WHERE month(MyDate) IN (2,3,4,7,8);

    so if you want to use pure query without FORM, you can use

    SELECT * FROM myTable WHERE month(MyDate) IN ([InputMonthsSeparatedByComma]) ;


    jiri

  4. #4
    Join Date
    Nov 2002
    Location
    Oakland, CA
    Posts
    126

    Talking

    As usual, great info, Jiri.


    Originally posted by playernovis
    use IN

    SELECT * FROM myTable WHERE month(MyDate) IN (2,3,4,7,8);

    so if you want to use pure query without FORM, you can use

    SELECT * FROM myTable WHERE month(MyDate) IN ([InputMonthsSeparatedByComma]) ;


    jiri

Posting Permissions

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