Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compact database and password help needed

Status
Not open for further replies.

angiem

MIS
Sep 29, 2000
116
0
0
CA
I have a database password set and I am using this code to compact and repair the database when it finishes it asks for the password again. Is there a way to get round that.

CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database utilities"). _
Controls("Compact and repair database..."). _
accDoDefaultAction
 
The reason it asks for the password again is because after copacting the database, it has to reopen it. So you need to figure out a way to feed the password to it. A quick and dirty way would be to use SendKeys. I don't know the exact syntax off hand, but you can look it up in help.
 
I don't think SendKeys will work.

Surely after the database has compacted any statements following that code will not be executed as the code will stop running as soon as the database is closed.

I'd strongly recommend not using database passwords anyway. It doesn't offer anywhere near as much security as workgroup security. In fact I'd go so far as to argue it doesn't really offer any at all, as anyone who can use Google can find something to crack a DB password in no time at all...

Ed Metcalfe.

Please do not feed the trolls.....
 
The SendKeys option although quick and dirty works
 
I stand corrected! I really didn't think that would do what you wanted.

Ed Metcalfe.

Please do not feed the trolls.....
 
You are probably correct about SendKeys. I have always felt like something was not right with it. It is a work-around for something that should require more thought and planning.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top