I have to rename a table in my code so I can do some comparing. anyway If I run my code manually (or by running a macro that calls the code) everything works as it should. BUT if I call the macro from a batch file the docmd.rename part doesnt run. the rest of the code does.
heres a simple way for you to replicate (either .mdb 2000/2003 or .accdb 2007)
1 x Table - Name: "Old" (content not important)
1 x Macro - Name: "Macro1"
*Macro Content*
RunCode - test()
Quit - SaveAll
1 x Module - Name: "module1"
*Module Content*
Public Function test()
MsgBox "Start"
DoCmd.Rename "New", acTable, "Old"
MsgBox "End"
End Function
now running the code or the macro manually everything works as it should.
however running from a batch file (see batch file below) results in the msgbox appearing so we know it is running the code but the table doesnt get renamed.
Batch File
"C:\Program Files\Microsoft Office\Office12\msaccess.exe" "D:\test\1.accdb" /runtime /nostartup /x Macro1
This is confusing the hell out of me because I see no reason why that particular cmd isnt working.
heres a simple way for you to replicate (either .mdb 2000/2003 or .accdb 2007)
1 x Table - Name: "Old" (content not important)
1 x Macro - Name: "Macro1"
*Macro Content*
RunCode - test()
Quit - SaveAll
1 x Module - Name: "module1"
*Module Content*
Public Function test()
MsgBox "Start"
DoCmd.Rename "New", acTable, "Old"
MsgBox "End"
End Function
now running the code or the macro manually everything works as it should.
however running from a batch file (see batch file below) results in the msgbox appearing so we know it is running the code but the table doesnt get renamed.
Batch File
"C:\Program Files\Microsoft Office\Office12\msaccess.exe" "D:\test\1.accdb" /runtime /nostartup /x Macro1
This is confusing the hell out of me because I see no reason why that particular cmd isnt working.