Specify table name when a query runs?

Myrna Larson

Registered User.
Local time
Today, 10:43
Joined
Aug 3, 2012
Messages
16
I have a current table and also have saved copies from previous dates. I want to compare records in two tables (older and current) and display just those records that have been changed.

I have created 2 queries:

1) the first selects all records and fields in the older table;

2) the 2nd selects from the newer table only those records where the Edit date is greater than a date the user inputs at run-time (i.e. the date is a parameter)

3) a UNION query displays the records from the 1st 2 queries in pairs, older record on top, new record below.

What I would like to do is enter the names of the older and new tables at run time (i.e. use parameters) instead of hard-coding the table names on the QBE sqreen or in the SQL statement.

Is that possible?
 
You can't use a parameter for the table; you'd have to build the SQL in VBA code. I'd question the process though. Have you looked into audit trail methods? They provide a record of changes made to data.
 
Thanks for your input. This is a relatively minor project, not worth audit trails, etc. I can handle the VBA code.
 

Users who are viewing this thread

Back
Top Bottom