Hey VFP Community!
I wanted to post this since I finally figured it out and it might help someone else. I initially gave up on it but decided to come back to see if I could solve the issue of Compact&Repairing an encrypted Microsoft Access Database through VFP code. Here is my original thread on the topic. thread184-1791777 I would like to thank everyone who helped and lead me on the right path to solving it.
Here is the code.
The missing part I found was I had to tell the DBEngine that the last part was the password with the ";pwd=1234abcd" in order for it to correctly open it.
My Microsoft database sits on a network drive so my code has the full path added to the server names which I removed from the code snippet above. If anyone does this just make sure there are no quotes in the lserver variable or else it will fail on you.
I hope this helps someone else out!
I wanted to post this since I finally figured it out and it might help someone else. I initially gave up on it but decided to come back to see if I could solve the issue of Compact&Repairing an encrypted Microsoft Access Database through VFP code. Here is my original thread on the topic. thread184-1791777 I would like to thank everyone who helped and lead me on the right path to solving it.
Here is the code.
Code:
lserver=[TestDB.accdb]
lbackdb=[Db_TestDB.accdb]
lcpass=[1234abcd]
oAccess = Createobject([Access.Application])
*!* oAccess.Visible=.T.
oAccess.Application.DBEngine.CompactDatabase(lserver, lbackdb, .F., .F., [highlight #FCAF3E]";pwd="+lcpass[/highlight])
oAccess.Quit()
Erase &lserver
Rename &lbackdb To &lserver
The missing part I found was I had to tell the DBEngine that the last part was the password with the ";pwd=1234abcd" in order for it to correctly open it.
My Microsoft database sits on a network drive so my code has the full path added to the server names which I removed from the code snippet above. If anyone does this just make sure there are no quotes in the lserver variable or else it will fail on you.
I hope this helps someone else out!