Change the name of a Table when you run the Make-Table Query

J

John Ortt

The title says it all really.

I wish to decide on the name of a Table when I run the Make-Table query.

It is for an events database and I want to copy the "PeopleList" for all
those people who are selected (tickbox) to a new table with the name of the
event as the title (eg. "Oktoberfest")

I tried putting [Select the name for your table] in as the table name on the
Make-Table query but it didn't work.

My other alternative is to use a Macro which references a piece of VBcode
which changes the name from "Unnamed" to the name of the user's choice.

Any suggestions? Any help greatly appreciated.

Thankyou,

John Ortt
 
D

Dirk Goldgar

John Ortt said:
The title says it all really.

I wish to decide on the name of a Table when I run the Make-Table
query.

It is for an events database and I want to copy the "PeopleList" for
all those people who are selected (tickbox) to a new table with the
name of the event as the title (eg. "Oktoberfest")

I tried putting [Select the name for your table] in as the table name
on the Make-Table query but it didn't work.

My other alternative is to use a Macro which references a piece of
VBcode which changes the name from "Unnamed" to the name of the
user's choice.

Any suggestions? Any help greatly appreciated.

Thankyou,

John Ortt

Do you really need to do this? It's not generally a good idea to put
data into table names. Wouldn't it be better to have a secondary,
related table, "PeopleEvents", with fields PeopleID (or name) and
EventID (or event name)?

The only way you can do what you're asking is to build the whole SQL
string of the query on the fly, and then use DoCmd.RunSQL or
CurrentDb.Execute to run it. But I really don't think this is a good
idea.
 
J

John Ortt

Good Point,

I think your Idea is better.....

Create two new tables, one for event names and another to link individuals
to the event.

Thanks Dirk.
 
Top