Add table to query

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

Guest

I would like the user to create a custom query, adding some of the tables
available. I have over 50 tables so I do not want to create a query on all
tables.

Is there any way I can do this using VBA? I have a little knowledge of VBA
and have tried to look this up on this discussion group but had no luck so
far.

If anybody could point me in the right direction that would be appreciated.

Thank you
 
I would like the user to create a custom query, adding some of the tables
available. I have over 50 tables so I do not want to create a query on all
tables.

I should say NOT! It wouldn't work for one thing.
Is there any way I can do this using VBA? I have a little knowledge of VBA
and have tried to look this up on this discussion group but had no luck so
far.

If anybody could point me in the right direction that would be appreciated.

Well... if you are storing information in table names (i.e. if you
want to add this table for one category of records, and a different
table for another category), then step back and redesign your table
structure so that you're storing data *in fields in the table*,
instead of in table names.

In a properly normalized database it would be very rare indeed that
the user would even need to *know* the names of tables, much less
enter them!

But to answer your question, you would indeed need to use VBA to
prompt for the name of the table and construct a SQL string. This
string could then be used as the recordsource for a form or a report.
Without more details about these tables, and what kind of query you
might need to construct, it's hard to be really specific.

John W. Vinson[MVP]
 
Back
Top