Hello all,
I need to change the name of a table in a Access 2007 database. The code below(VBA) does what I need BUT I need it in VBScript. Can someone help me "translate" it ?
Sub changetablename()
Set db = CurrentDb()
For Each n In db.tabledefs
tablename = n.Name
If tablename = "_help pages" Then
n.Name = "helppages"
End If
Next
Set db = Nothing
End Sub
In VBscript I managed to go as far as connecting to the database as follows(do while below only to test that connection works - and it works):
Set conn = CreateObject("ADODB.Connection")
strConnect = "DSN=Mdb;DBQ=c:\umana\data\project.MDB;DefaultDir=c:\umana\data;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"
conn.Open strConnect
StrSQL = "Select * from helppages"
Set rs = conn.Execute(StrSQL)
Do While not rs.EOF
msgbox(rs(1))
rs.MoveNext
Loop
I'm running the VBScripts from a Visual Foxpro program, that's also working. So all I need is to continue this VBscript to accomplish what I've done in VBA.
Thanks in advance.
-gl
I need to change the name of a table in a Access 2007 database. The code below(VBA) does what I need BUT I need it in VBScript. Can someone help me "translate" it ?
Sub changetablename()
Set db = CurrentDb()
For Each n In db.tabledefs
tablename = n.Name
If tablename = "_help pages" Then
n.Name = "helppages"
End If
Next
Set db = Nothing
End Sub
In VBscript I managed to go as far as connecting to the database as follows(do while below only to test that connection works - and it works):
Set conn = CreateObject("ADODB.Connection")
strConnect = "DSN=Mdb;DBQ=c:\umana\data\project.MDB;DefaultDir=c:\umana\data;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"
conn.Open strConnect
StrSQL = "Select * from helppages"
Set rs = conn.Execute(StrSQL)
Do While not rs.EOF
msgbox(rs(1))
rs.MoveNext
Loop
I'm running the VBScripts from a Visual Foxpro program, that's also working. So all I need is to continue this VBscript to accomplish what I've done in VBA.
Thanks in advance.
-gl