Generate Table with a Random Name (1 Viewer)

nashken

New member
Local time
Today, 01:51
Joined
Oct 20, 2015
Messages
8
Is there any way to write a query that will generate a table with a random name WITHOUT using VBA.
Using access 97 but soon access 2007.

I know I can do this with VBA but have been tasked with doing it without VBA.

Why: it's a job I get paid and I've had the fight and lost. If I can't do it then I can't do it.
 

spikepl

Eledittingent Beliped
Local time
Today, 08:51
Joined
Nov 3, 2010
Messages
6,142
define "generate table with random name" and its use by example
 

jdraw

Super Moderator
Staff member
Local time
Today, 02:51
Joined
Jan 23, 2006
Messages
15,379
Please tell us more.
Why? Who will use it (if they can find it)?
I can't picture the usefulness of a file with a random name, but I do come from a background where data management was a priority.
 

nashken

New member
Local time
Today, 01:51
Joined
Oct 20, 2015
Messages
8
Say I want to have a query create a table named based upon the current date and time. So
Parameter @newtable = date()
select into @newtable from tblData
 

jdraw

Super Moderator
Staff member
Local time
Today, 02:51
Joined
Jan 23, 2006
Messages
15,379
Yes,I did something like that many years ago. I had a function that returned some numeric characters based on the current time.
I used to add it to a file name to get a common file name with an included timestamp.

It really wasn't a random file name; it was a way to put a date/time stamp into the file name.
 

nashken

New member
Local time
Today, 01:51
Joined
Oct 20, 2015
Messages
8
Was this in vba? Also not dealing with a file but with a table.
 

jdraw

Super Moderator
Staff member
Local time
Today, 02:51
Joined
Jan 23, 2006
Messages
15,379
It was a function written in vba.
 

nashken

New member
Local time
Today, 01:51
Joined
Oct 20, 2015
Messages
8
Sadly vba is not an option or I would be done. Thanks!
 

Minty

AWF VIP
Local time
Today, 07:51
Joined
Jul 26, 2013
Messages
10,366
Have you tried to write an SQL CREATE query where the table name is a derivative of the date or similar ? You can do that in the query designer in SQL view.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:51
Joined
Sep 12, 2006
Messages
15,634
I expect I will be proved wrong, but I just do not see how you can create the file without some code.
 

nashken

New member
Local time
Today, 01:51
Joined
Oct 20, 2015
Messages
8
Yes. Using a parameter. But the query fails. It appears you cannot use a parameter as a table name. I was hoping someone new of a method in a macro.
 

Users who are viewing this thread

Top Bottom