I need to rename a table in an Access database (this is an import database that gets shipped to us once a week, and for reasons too lenghty to go into, I have to rename one of the tables before I can process that data in it.) Here is what I have:
I'm getting a syntax error, the description for which is anything but helpful. How do you programmatically rename a table in a DB?
Code:
Dim ADOCn As ADODB.Connection
Dim ConnString As String
Dim adoRS As ADODB.Recordset
Dim sSQL As String
ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\DBName.mdb;" & _
"Persist Security Info=False"
Set ADOCn = New ADODB.Connection
ADOCn.ConnectionString = ConnString
ADOCn.Open ConnString
sSQL = "ALTER TABLE table_name RENAME 'table_name_new'"
ADOCn.Execute sSQL