Query based on continously new created tables

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

Guest

I would like to know how to create a query that takes data from different tables each time the query is run

In my database, new tables are created continously. All these tables have the same structure and the table names begin with the letters "mi". I would like to write a query that takes data from one of these tables, and I would like the user to choose exactly which table (preferably from a list box). Is there a way to do this

Thanx for helping me !

/ Lina
 
Lina,

In theory you could do it by using some VB code to change the query
definition according to the user's selection in the listbox.

Yet, this sounds like sub-optimal design! I would suggest you change your
design so that all of the data is kept in one table, using an extra field to
differentiate which records belong to each of the currently separate tables.
Then you can append to that table instead of creating new ones, and simplify
your query by using the "table name" as a criterion on the new field in your
query, with no need to change the query itself, manually or through code.

HTH,
Nikos

Lina said:
I would like to know how to create a query that takes data from different
tables each time the query is run.
In my database, new tables are created continously. All these tables have
the same structure and the table names begin with the letters "mi". I would
like to write a query that takes data from one of these tables, and I would
like the user to choose exactly which table (preferably from a list box). Is
there a way to do this?
 
I don't have anything directly on point, but on my website (see sig below) I
have several small sample databases that might help: "ChooseReportFields",
"ChooseReportFieldsRows", "CreateQueries2", and "CreateQueries4". The first
two are the closest to what you want, but you might want to borrow elements
of the other two as well.

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org

Lina said:
I would like to know how to create a query that takes data from different
tables each time the query is run.
In my database, new tables are created continously. All these tables have
the same structure and the table names begin with the letters "mi". I would
like to write a query that takes data from one of these tables, and I would
like the user to choose exactly which table (preferably from a list box). Is
there a way to do this?
 
I would like to know how to create a query that takes data from different tables each time the query is run.

In my database, new tables are created continously. All these tables have the same structure and the table names begin with the letters "mi". I would like to write a query that takes data from one of these tables, and I would like the user to choose exactly which table (preferably from a list box). Is there a way to do this?

Thanx for helping me !!

/ Lina

Nikos is (as usual) bang on. This cannot be done using a Query, since
you cannot pass a tablename as a parameter. You should NOT be storing
data in tablenames as you are doing; it makes things much more
difficult, not easier!
 
Back
Top