Query Table Name

  • Thread starter Thread starter KayC
  • Start date Start date
K

KayC

I have a query already set up, but I now need
to change the underlying table name.
How do I do this?
 
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.
 
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
 
Back
Top