tablemakequery

  • Thread starter Thread starter Taco
  • Start date Start date
T

Taco

HEllo,

How can i create tablemakequery that gives the table
every time a different name.


Thank you

Taco
 
Hi,

What is the use of such a table... what will be the SQL statement that
will interact with a table name you don't know in advance, except if you
build the text of the SQL statement at run time?

You can always built the SQL statement (string) that creates the table,
inserting the VBA generated random name, but is that really a useful design?
why not adding an extra column to ONE GIVEN table, instead?

MyBigTable 'table name
MyData1, MyData2, MyData3, WouldBeTableName ' fields


Then,


SELECT *
FROM MyBigTable
WHERE WouldBeTableName= "qwerty"


is logically the same as your initially planned


SELECT *
FROM qwerty


except that this last statement impossible to "save" since you do not know
the name qwerty, but the previous one, just change the constant for a
parameter and you have your saved query. Further more, the large table makes
"inter initial-tables check" very easy, while you need much more experience
to write a general query involving multiple tables (with an unknown name).
And finally, the large table is closer to what SQL expect to operates on,
so, it untimely provides you with an easier work, for the future, to work
with the flow, than alone, or against the current flow.


Hoping it may help,
Vanderghast, Access MVP
 
Suggest you check the Relational Database Design Principles and see if what
you are trying to do follow the principles. Note that in general, you
shouldn't have Tables of same or similar structure. What you asked seems to
fit exactly that.

In addition, you generally create Table Structure during the design phase of
the Database. Once the Database is in operation, additional data should be
store in existing Tables, not new Tables.

Ocassionally, developers create temporary Tables but then the temp. Tables
are deleted shortly after and the names are re-used later.
 
Back
Top