Prompt user for table to query?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

OK, this probably falls into the "you-can't-do-that" category, but it's worth
a shot.

In my db, I am storing periodic 'snapshot' tables. I want to choose which
table to run my queries from, without needing to go to design view, add the
new table, delete the old table, etc. etc. One trick I have used is going to
SQL view, copying & pasting the code into Wordpad, replacing the old table
name with the new table name, then pasting that back into the query. Still
too many steps.

So, is there any easy way I can create a prompt for the table to query?
(All tables have the same fields.)

Thanks,
/LJ
 
You can do it programmatically.

Assuming you saved the form with the table name "Table1", and you want to
switch it to "Table2":

strSql = Me.RecordSource
strSql = Replace(strSql, "Table1", "Table2")
Me.RecordSource = strSql
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top