Create new table with current date part of the name using sql

  • Thread starter Thread starter ma1000
  • Start date Start date
M

ma1000

Hi

Is it possible to create a new table with the current date as part of the
table name. If it is possible could someone help me with how the sql
statement would look like. Even if the current date is the actual table name
it would still meet my requirements

Thanks in advance
 
Before the "how to", "why?"

It is rarely a good idea to embed data in a tablename (or fieldname, for
that matter). By trying to create a new table with a date as part of the
table name, you are trying to embed data in the tablename.

Why? As in "why do you feel you need the date in the tablename?" And what
will having the date in the (new) tablename allow you to do?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Thanks for quick response.

My challenge is that i am importing tables with duplicate records from a
text file into Access. Once the table has been imported i select certain
columns/fields from it in order to create a table with a primary key for data
integrity(unique records). I build my queries from that relational table
rather than the one with duplicates.

I perform this procedure once a month, so i would think if i could automate
this through the use of a macro it would be easier to create a new table for
each month rather then append to an existing table. I could be wrong so
please advise if there is a better way.

Thanks
 
If you are saying that you are using the "month" to identify different
records, then a much simpler approach would be to append those new records
into the same table each time, once you've added a date/time field to that
(single) table and added a field something like:

CurrentDate: Now()

to your append query.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Thanks Jeff.

I will try it your way it should work as each month will have a different
date which will make the records unique from the previous month.

Just out of curiosity, was my initial question even possible to execute?
 
I can drive nails with my chain saw.

Is it possible? Is it a good use of the tool? Is it a good idea? <g>

Access is a relational database. What you described sounds like what you'd
have to do if you were using a spreadsheet. Access is not a spreadsheet on
steroids.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top