how do i connect to a password protected ms access database using visual basic ado (not the visual component). ive heard it has something to do with the connection string ... please help..
ms access and visual basic
Option Explicit
Public conn As ADODB.Connection
Public rs As ADODB.Recordset
----------------
Dim database$
database= App.Path + "\adresses.mdb"
Set conn = New ADODB.Connection
conn.CursorLocation = adUseClient 'set cursor
'conn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & database& ";Persist Security Info=False;"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & database& ";Persist Security Info=False;"
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = conn
rs.Open "select * from adresses order by name", , adOpenKeyset, adLockOptimistic, adCmdText
Public conn As ADODB.Connection
Public rs As ADODB.Recordset
----------------
Dim database$
database= App.Path + "\adresses.mdb"
Set conn = New ADODB.Connection
conn.CursorLocation = adUseClient 'set cursor
'conn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & database& ";Persist Security Info=False;"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & database& ";Persist Security Info=False;"
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = conn
rs.Open "select * from adresses order by name", , adOpenKeyset, adLockOptimistic, adCmdText
where did the username and password for the database go?
hi, append this to the end of the connection string
Hope this help
| Quote: |
|
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & database& ";Persist Security Info=False;User id=[you-username-here];Password=[you-password-go-here];" |
Hope this help
tnx blueray but i got a follow-up question, how do i set the username and password in ms access.. hehehe

