Results 1 to 4 of 4
  1. #1
    RedWolf3x is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Jul 2011
    Posts
    31

    Combo box to Select Table to Query

    I have several linked tables that I'm trying to Query

    January through December

    I have a Query



    Select * from November
    (That's not my query, but it gets my point across)

    What I'm looking to do is have a Combobox that will change which table the Query is running.

    Select * from (whatever table my combobox says)

    Is it possible? and if so how?

    I'm trying to avoid having to rewrite the query for each month and use VBA to select which Query to run

  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,640
    It won't be easy, because your design is not normalized. Data should be in one table, with a date or month field. That lets you query data out with a simple criteria for any month or combination of months. To do what you're describing, you'll need to create or modify the query in code. Searching on QueryDef should turn up similar code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    RedWolf3x is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Jul 2011
    Posts
    31
    Thank you, Your response gave me an idea that I had not though of.

    I created a Union query combining all the data from the tables, then used the query to filter it out.

    Thanks.

    RedWolf3x

  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,640
    No problem. The union query is basically normalizing the data.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 09-17-2012, 10:36 AM
  2. Select Query > Update Query > Table Field
    By tuggleport in forum Queries
    Replies: 2
    Last Post: 08-09-2012, 07:04 AM
  3. Using form combo box in query to select date.
    By LordNecro in forum Access
    Replies: 2
    Last Post: 04-14-2012, 05:09 AM
  4. Replies: 2
    Last Post: 01-31-2011, 08:31 AM
  5. Replies: 2
    Last Post: 03-14-2010, 07:27 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