Results 1 to 8 of 8
  1. #1
    wavequationteledyne is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Posts
    4

    query criteria from form

    I have a form with list boxes containing information from a table. I would like write a query which is the record set for one list box that uses the value of another list box for a criteria, but doesn't use anything if the criteria list box has no value selected.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Last edited by pbaldy; 05-27-2015 at 02:16 PM. Reason: typo
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    wavequationteledyne is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Posts
    4
    It does, but I can't understand why....

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Do you want dependent (cascading) listboxes? Example with comboboxes will work with listboxes http://datapigtechnologies.com/flash...combobox2.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    wavequationteledyne is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Posts
    4
    now I understand how pBaldy's solution worked, but I have another problem. It worked at first, but then the Access Query design view seems to be corrupting it somehow...

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The design grid will screw around with it and if memory serves, splits the form reference to a new field. It should still work, but looks goofy.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    wavequationteledyne is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Posts
    4
    I had to delete the query and rewrite it, but it does work even though the design grid does do what you just said. Now, I'd like to do the same thing with another list box, so that there are two criteria... I'm adding the second field as a criteria, and using the "[control] or [control] is null", but it isn't working as I'd like it to....

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    These are called 'cascading' for a reason. Usually third combobox only needs criteria based on second combobox and second combobox has criteria based on first combobox - like dominos.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 11-13-2014, 11:34 PM
  2. Replies: 1
    Last Post: 03-28-2013, 07:54 AM
  3. Replies: 5
    Last Post: 09-20-2012, 03:27 PM
  4. Using form fields as query criteria
    By bener in forum Queries
    Replies: 3
    Last Post: 10-28-2011, 12:54 PM
  5. Query criteria in a form
    By sefiroths in forum Queries
    Replies: 1
    Last Post: 12-23-2009, 05:15 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
  •  
Other Forums: Microsoft Office Forums