I have set up a single password to my back-end database by opening it exclusively and then entering the password by menu Tools->Security->Set Database Password. In my codes, I have a line to compact the back-end which worked before implementation of the password:
DBEngine.CompactDatabase “Backend Database”, “Compact Database”
Now I am asked to key in the password whenever the code is run. How could I pass on the password to CompactDatabase without keying it in like in the code:
Set db = OpenDatabase(BackendDatabase, False, False, “;PWD=” & PASSWORD)
But I can’t open a database and then compact it.
Another alternative I am thinking of is to temporarily delete the password, run the CompactDatabase line, and then put the password back. But I don’t know how to do it. I tried using
Set db = OpenDatabase(BackendDatabase, False, False, “;PWD=” & PASSWORD)
db.NewPassword DBPASSWORD, “”
but I was told I couldn’t change the password of a shared open database. How can I access the back-end exclusively then?
Can any one help me? Thanks in anticipation.