How do I open a password-protected database from Visual Basic?
If you have password-protected a database using the simplified password-based security, you can open the database by using Visual Basic 4.0 and later using code similar to the following (assuming the database is located at “c:\path\database.mdb” and the password is “curry”: Dim wrk as Workspace Dim dbProtected as Database Set wrk = DBEngine.Workspaces(0) Set dbProtected = wrk.OpenDatabase(“c:\path\database.mdb”, _ False, False, “;PWD=curry”) This same code will also work with Microsoft Access 95, Microsoft Access 97, and Microsoft Access 2000 when attempting to open a password-protected database programmatically. (The above code won’t work with Microsoft Access 2.0 or Visual Basic 3.0, because the Jet 1.x and Jet 2.x database engines don’t support database passwords.