Changing the source of a query

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

Guest

I have several queries that are linked to a table in my database. I would
like to replace this table with a query containing the same fields. However,
I'm afraid that I'm going to have to manually change the source of each field
in my origional queries.

Is there a way to change the source for all fields in a query at once?
Thanks!
 
First make a back up to your mdb

You can try something like

Application.CurrentDb.QueryDefs("QueryName").SQL =
Replace(Application.CurrentDb.QueryDefs("QueryName").SQL,"TableName","NewQueryName")

This code will replace the table name with the query name
 

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