Monthly Query

J

jac007

I'm not sure how to do this but I know it is possible. If I have a table
that gets created every month with table name NOV 07 and the following month
table DEC 07 and so on.........is there a way to have a query to extract the
data from NOV 07 table and when its the next month run the same query but for
the DEC 07 table. The queries will then be used to create monthly reports.
How can this be done?
 
K

Klatuu

First point. You design is incorrect. There should not be a situation where
each month is in a different table. Use a field in your table to identify to
which month it belongs. You question shows that you are already feeling the
effects of the design error.

No yeah, but, we have to import this data from.....
Nope, you can still import the data. It just may take an extra step, like
importing it into a temp table, running an append query that adds the month
to the table and appends to you regular table. ie: There is absolutely no
valid reason to have multiple tables with the same month.

Sorry, don't mean to rag on you, I really am trying to help.

You cannot use a stored query because the table name changes each month.
What you will have to do is construct the SQL programmatically.
 
J

jac007

You are so right! Thanks for that, it really puts things in perspective.
Thank you!
 
Top