Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programatically creating a copy of an existing table in the same db

Status
Not open for further replies.

VBAguy22

IS-IT--Management
Aug 5, 2003
180
0
0
CA
Hello
I need to archive myTable as myTable_old in the same db.
How do I do it in VB?
 
Here's the code - minus the error handling:

Code:
Public Sub (strTable As String)
Dim strNewTable as String, strSQL As String

DoCmd.SetWarnings False

strNewTable = strTable & "_old"
strSQL = "SELECT [" & strTable & "].* INTO [" & strNewTable & "] " _
    & "FROM [" & strTable & "];"
doCmd.RunSQL(strSQL)

DoCmd.SetWarnings True
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top