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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename an Access table in VB 1

Status
Not open for further replies.

vietnam97

Programmer
Sep 18, 2000
48
0
0
I'm using DAO in visual basic, and I need to rename an access table MyTable to MyBackup, how would I do it?

Thanks,

Bao
 
Public Sub RenameTable(DataBaseName, InputTableName As String, OutputTableName As String)
Dim DB As Database
Dim TDF As TableDef
Set DB = OpenDatabase(DataBaseName, True, False)
For Each TDF In DB.TableDefs
If UCase$(TDF.Name) = UCase$(InputTableName) Then
TDF.Name = OutputTableName
End If
Next
MsgBox "Done!", vbInformation
End Sub

Private Sub Command1_Click()
RenameTable "C:\db1.mdb", "MyTable", "MyBackup"
End Sub

Swi
 
Thanks for the info swi. Now how do I copy one table into the other e.g. MyTable to MyBackup?

Bao
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top