Rename a table

B

BobS

I need to rename a table every month. New data comes in
monthly for a phone bill. I want to rename the table by
appending a date or sequence number. Then I'll import the
new data into a new table.

I want to create a button that will rename the database
and automatically append a date or sequence number to the
name. Can this be done with a macro?? or is there a
better way??

THANKS
 
E

Eric Butts [MSFT]

Hi Bob,

Do something like the following:

Function CreateNewTables()
Dim tblName As String
Dim strQry As String

tblName = "table Name" & Now()
strQry = "SELECT [Table name].* INTO " & tblName & " FROM [Table
name];"

Currentdb.execute strQry
End Function

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights


--------------------
| Content-Class: urn:content-classes:message
| From: "BobS" <[email protected]>
| Sender: "BobS" <[email protected]>
| Subject: Rename a table
| Date: Thu, 8 Apr 2004 07:14:48 -0700
| Lines: 11
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcQdc9nlyzE1Pd0QRNC/vHmK85KzVg==
| Newsgroups: microsoft.public.access.macros
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.macros:31107
| NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163
| X-Tomcat-NG: microsoft.public.access.macros
|
| I need to rename a table every month. New data comes in
| monthly for a phone bill. I want to rename the table by
| appending a date or sequence number. Then I'll import the
| new data into a new table.
|
| I want to create a button that will rename the database
| and automatically append a date or sequence number to the
| name. Can this be done with a macro?? or is there a
| better way??
|
| THANKS
|
 

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