VB Access Data Con with Password
Page 1 of 1 • Share •
VB Access Data Con with Password
To Connect access database with password protection in vb the following module is:
Public Sub MAKECONNECTION(ByVal cn As ADODB.Connection, rs As ADODB.Recordset, SQLQUERY As String)
'CLOSE THE CONNECTION IF ALREADY OPEN
If cn.State = adStateOpen Then
cn.Close
End If
'OPENS A CONNECTION TO DATA SOURCE(FOR MS ACCESS)
With cn
'.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "D:\database.mdb" & ";Persist Security Info=False;Jet OLEDB:Database Password=debmedia"
.CursorLocation = adUseClient
.Open
End With
'OPENS A RECORDSET
With rs
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.Source = SQLQUERY
.ActiveConnection = cn
.Open
End With
Public Sub MAKECONNECTION(ByVal cn As ADODB.Connection, rs As ADODB.Recordset, SQLQUERY As String)
'CLOSE THE CONNECTION IF ALREADY OPEN
If cn.State = adStateOpen Then
cn.Close
End If
'OPENS A CONNECTION TO DATA SOURCE(FOR MS ACCESS)
With cn
'.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "D:\database.mdb" & ";Persist Security Info=False;Jet OLEDB:Database Password=debmedia"
.CursorLocation = adUseClient
.Open
End With
'OPENS A RECORDSET
With rs
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.Source = SQLQUERY
.ActiveConnection = cn
.Open
End With
Admin- Admin
- Posts : 256
Join date : 2008-06-06

» Easy access venue required please
» Massive Data Base
» Importing data into Oziexplorer
» S> Suriamas Access Card
» Bega 1:250 000 Metallogenic Map SJ 55-4 Mine Data Sheets and Metallogenic Study
» Massive Data Base
» Importing data into Oziexplorer
» S> Suriamas Access Card
» Bega 1:250 000 Metallogenic Map SJ 55-4 Mine Data Sheets and Metallogenic Study
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum