Results 1 to 5 of 5
  1. #1
    gdshih is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    4

    Creating a Dynamic Query

    I am trying to create a query which will change depending on what is selected in a combo box. This is what I have been putting into the criteria but it doesn't seem to be working:

    [Forms]![frmMainMenu]![cboDeptName]

    Any help would be greatly appreciated, thanks!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Why is not working - error message, wrong results, no results?

    Is the combobox multi-column?
    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.

  3. #3
    gdshih is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    4
    I don't see any results. No, the combo box is not multi-column.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    In regards to your PM, make sure you aren't using the .Text property of the combo, as it requires focus. What you posted should work. Is the form open at the time the query runs? Does the combo return the same value the query is looking for, as opposed to an ID instead of a name or something? Can you post the db here, or a representative sample?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Are you viewing the results of the query in a form? Probably need to requery the form after combobox selection. In the AfterUpdate event of combobox, include code: Me.Requery. Is the query form a subform? Then: Me.subform.Requery

    If you need more help, provide project for analysis.
    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. Creating a dynamic search box in Access 2010
    By bob500000 in forum Access
    Replies: 1
    Last Post: 11-24-2011, 02:27 PM
  2. Dynamic Form, Dynamic labels/ captions?
    By JFo in forum Programming
    Replies: 15
    Last Post: 10-12-2011, 08:33 PM
  3. Creating a Dynamic Query
    By JackRush in forum Queries
    Replies: 2
    Last Post: 06-26-2011, 10:47 PM
  4. Replies: 1
    Last Post: 07-30-2010, 10:28 AM
  5. Dynamic SQL Query
    By Squeaner in forum Queries
    Replies: 0
    Last Post: 09-25-2008, 02:37 PM

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