Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005
    Posts
    2

    Use same query with different table


    Every month I create an Excel report, then import it as a table into Access. I created queries to pull certain data from that table. Queries work fine until I import the next months report. Every months table has the same column headings but different values. When I put the new table in the query and change the table to the new one and run it the numbers are all wrong. If I delete the old table everything disappears from the query grid. Basically what I want to do is run the same query every month on a different table. Please help

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275

    Re: Use same query with different table

    Quote Originally Posted by fashoda
    Every month I create an Excel report, then import it as a table into Access. I created queries to pull certain data from that table. Queries work fine until I import the next months report. Every months table has the same column headings but different values. When I put the new table in the query and change the table to the new one and run it the numbers are all wrong. If I delete the old table everything disappears from the query grid. Basically what I want to do is run the same query every month on a different table. Please help
    There are two things you can do:

    1) If you just want to use the query designer, then open the query in design view, add the new table, and for each column in your query change the table designation to the new table. Then delete the old table and save the query.

    2) If this is part of a larger process that is pretty stable, automate the process. If all that is is changing is the table name, it would be easy to use VBA to either manipulate the QueryDef object, or if you need it as an action query, build the SQL string in code and run it using DoCmd.RunSQL.

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

Similar Threads

  1. Adding new column to make-table query
    By dtn118 in forum Access
    Replies: 2
    Last Post: 08-03-2008, 06:51 AM
  2. Loop a table to use field in query
    By jdubp in forum Programming
    Replies: 0
    Last Post: 03-04-2008, 11:48 AM
  3. How to query boolean values from table
    By kevdmiller in forum Queries
    Replies: 2
    Last Post: 11-30-2006, 07:41 PM
  4. Replies: 0
    Last Post: 09-25-2006, 03:42 AM
  5. Using same query with different table
    By fashoda in forum Queries
    Replies: 1
    Last Post: 12-14-2005, 12:05 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