Hi, is it possible to rename a MS-Access Table in VB, and if so How?
Printable View
Hi, is it possible to rename a MS-Access Table in VB, and if so How?
Yes, certainly!
The follow code change name Table1 to Table2 in MS Access database.
Best regards.Code:Dim dbTest As Database
Dim tblObj As DAO.TableDef
Dim sTBLName As String
Dim bIncludeSysTables As Boolean
Set dbTest = OpenDatabase("d:\db1.mdb", True)
For Each tblObj In dbTest.TableDefs
If (tblObj.Attributes And dbSystemObject) = 0 Or bIncludeSysTables Then
sTBLName = tblObj.Name
If sTBLName = "Table1" Then tblObj.Name = "Table2"
End If
Next
dbTest.Close