Prompt User for table name in Make Table Query

B

Bruce

I have a table that I am allowing users to make selections from using a yes/no field with checkbox format. A select query will allow them to view the results of the items they chose, but I want them to be able to save the selected items in a new table. When I change the query type to a Make Table Query, I have to designate the name of the new table. I would like to be able to prompt the user for them to provide their own table name.
 
J

John Vinson

I have a table that I am allowing users to make selections from using a yes/no field with checkbox format. A select query will allow them to view the results of the items they chose, but I want them to be able to save the selected items in a new table. When I change the query type to a Make Table Query, I have to designate the name of the new table. I would like to be able to prompt the user for them to provide their own table name.

To do so you will have to write VBA code to prompt for the table name,
and construct the SQL of the MakeTable in code before executing it.

THIS IS A BAD IDEA. Storing data - especially arbitrary, user-selected
data - in table names will cause no end of trouble; the database will
bloat with half- or completely-forgotten tables. The new tables will
not be indexed, and will not link to any other tables. Are you
*certain* that there is enough benefit to outweigh these problems?
 
B

Bruce

An example would be very much appreciated, Tom. My boss is really breathing down my neck on this one
 
T

Tom Wickerath

I agree with John Vinson's comments. I thought about replying back with a similar answer
just minutes after posting my first response, but I had already shut down my PC by that
time.....

One way around the "half- or completely-forgotten tables" issue might be to tack on an
identifier onto the table name that the user enters. For example, if the user enters "My
Table" as the name, then you might tack on "User", as in "UserMy Table" for a table name.
However, I think it would be much better to use the name that a person enters to create an
Excel spreadsheet with the same name.

I didn't mean for you to post your e-mail address on the newsgroup.....just to send me a
private e-mail.
__________________________________


An example would be very much appreciated, Tom. My boss is really breathing down my neck
on this one
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top