password related question

S

SomSallyX

Hi


I'm trying to write a simple viewer to display the tables and records in the
MS Access database.

Is there anyway i can know whether the database is password protected so
that i can ask for the password and supply it programmatically to the
database. (I'm using ADO/ADOX with VB)



Warm Regards
 
G

George Nicholson

There may be a more elegant solution, but what I have done in the past is to
try and access the db without a password and trap for a specific error: 3031
"Not a valid password" (using DAO). If that error is triggered, I prompt
the user for a password and try accessing the db again. Note that if the
password that the user supplies is incorrect, the same error is triggered.
In case the user doesn't know the password, be sure to provide a way out of
the otherwise endless loop.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top