Opening Password-Protected Databases

Opening Password-Protected Databases

Use the connect parameter of the OpenDatabase method to open adatabase that is password-protected in VB4-32. For example, thiscode opens the Secure database with a password of “dirt”:

 Dim wrk As WorkspaceDim dbTest As DatabaseSet wrk = DBEngine.Workspaces(0)' Open Secure database with a ' password of "dirt".Set dbTest = wrk. _        OpenDatabase("Secure.mdb", _        False, False, ";PWD=dirt")

The connect parameter is case sensitive. In addition, and contraryto the VB documentation, you must set the exclusive and read-onlyparameters (the second and third parameters) when using the connectparameter.


Share the Post: