Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ms access password in vb

Status
Not open for further replies.

tigars

Programmer
Nov 14, 2007
3
CA
I want to know how to access a ms access database which have already a password with vb coding. How can i ask the user to enter a password to access the database.
Example: the ms access database have the password "password
 
I'm a new VB programmer. Here is my code. When my ms access database have no secure password, it's work (strpassword=""). But, when i put a secure password to my ms access database (pass), i can't open the database.
Can you help me. Thank you!
Note: the coding will be very helpfull.

Public Sub SetDB(strpassword As String)
Dim path As String
path = App.path
' Dim DB As DAO.Database
' strpassword = "pass"
On Error GoTo Erreur
Set DB = OpenDatabase(path & "\datbase.mdb", , , strpassword)
Exit Sub
Erreur:
MsgBox "Can’t open database. (datbase.mdb)", vbCritical, "Erreur"
End
End Sub


Private Sub Form_Load()
Dim strpassword As String
SetDB strpassword
…..
 
thank you for your help. i add "false" and it works.

strpassword = ";pwd=" & "physio"
On Error GoTo Erreur
Set DB = OpenDatabase(path & "\physio.mdb", False, False, strpassword)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top