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.
 
Top