omarswan
Oct 15th, 1999, 02:25 AM
Hi, is it possible to rename a MS-Access Table in VB, and if so How?
smalig
Oct 15th, 1999, 03:19 AM
Yes, certainly!
The follow code change name Table1 to Table2 in MS Access database.
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
Best regards.