changing tables in query question

baseball

Board Regular
Joined
Apr 1, 2002
Messages
153
Access 2007/Win 7: I have a database with large tables covering different time frames. Sometimes I develop a query using Query Design for one period, then need to run the same query with another time period. I go to Edit Query/Show Tables and pick the new one, then I have to go to each field and change the table source. Is there some way change all the fields at once?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
view the query as sql

copy the sql to notepad

find where it ways

from mytable

change it to
from mytable as t

then do a search and replace

replace all
mytable.
with
t.

now copy the sql and put it back into access

it should run fine, and from now on anytime you want to change the table you only have to change one thing

change
from mytable as t
to
from mytable_2010 as t
then next time
change it to
from mytable_2011 as t
 
Upvote 0
I thought of that way of doing things but I was hoping there was some easy way. Most everything in Windows lets you select a number of things and apply something to all at once. I sometimes think Access is not a Microsoft product.
 
Upvote 0

Forum statistics

Threads
1,224,568
Messages
6,179,595
Members
452,927
Latest member
whitfieldcraig

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top