View Full Version : change source table for queries


rgamlin
09-07-2004, 12:17 PM
I'm absolutely at a loss.

For purposes of maintenence and organization, I renamed all of my tables and queries.

Changing the source for my reports is no problem; what is absolutely killing me is trying to figure out how I can change the source tables for my queries.

i.e. if a table was previously called tblABC, and is now called tblA-B-C, how can I get any query to change where it looks for the data from tblABC to tblA-B-C?

There has to be a better way than going in and replacing each field in all my queries, one by one by one!



For what it's worth, most of my queries pull from a single table (i.e. one quert looks at one table, the next query at another, etc.)

Many thanks in advance,
Ryan

please copy PM on reply as well if possible.

Pat Hartman
09-07-2004, 01:23 PM
I hope you didn't really change your query name to include dashes! Letters, numbers, and the underscore are the ONLY characters that should ever be used to name objects.

If you are using A2K or newer, turn on the name autocorrect options. You also should read the article in the MSDN on the topic. Name autocorrect is confusing but the article explains it pretty well. Also, this feature has a bug and causes problems in A2K unless you have applied sp3 to Office.

I usually use an alias for the table/query names in my queries. It makes it easier for me to manually change names.

Select a.fld1, a.fld2, a.fld3, a.fld4,....
From YourTable as a;

Using that technique all I need to do is change YourTable to YourOtherTable a single time.