Query Table Name

K

KayC

I have a query already set up, but I now need
to change the underlying table name.
How do I do this?
 
D

Douglas J. Steele

In code you can try something like:

CurrentDb.QueryDefs("NameOfQuery").SQL = _
Replace(CurrentDb.QueryDefs("NameOfQuery").SQL, "OldTableName",
"NewTableName")

Manually, you can open the query in Design view, switch to SQL view then
change the name. Unfortunately, Access doesn't have any editing tools when
working with SQL: you might find it best to copy into Notepad, make the
change, then copy back into the query.
 
J

JMalecha

This code solution looks like exactly what I am looking for, but this does
not work as typed. My question is do I need a new query with this code or do
I insert this somewhere in my current query? I keep getting syntax errors.
Thanks
 

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

Top