
VB5 accessing password protected MDB?
Hi Jim
If you want to use the OpenDatabase method to open a password-protected
database, specify the database password as part of the Connect argument.
The syntax to open a database with the OpenDatabase method is as follows:
Set db = workspace.OpenDatabase(dbname, options, read-only, connect)
exp:
Sub OpenDB()
Dim db As Database
Dim ws As WorkSpace
Dim rst As Recordset
Set ws = DBEngine.WorkSpaces(0)
Set db = ws.OpenDatabase _
("C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb", _
False, False, "MS Access;PWD=northwind")
Set rst = db.OpenRecordset("Customers", dbOpenDynaset)
If rst.RecordCount > 0 Then
rst.MoveLast
MsgBox rst!CustomerID
End If
rst.Close
db.Close
End Sub
Hope this helps.Let me know if this helps.
Regards
A.V.Narayanan
Aditi Technologies Pvt Ltd
http://www.aditi.com
Quote:
> >I need to protect an MDB with the simple "password" scheme
> >(not the "user authorizations" scheme"); but I have not
> >understood how can I access such MDB from a VB5 application!
> Use ";pwd=yourpassword" as the "connect" argument to OpenDatabase
> -- Jim Ferguson, FMS
> http://www.fmsinc.com