VB Access Data Con with Password

View previous topic View next topic Go down

VB Access Data Con with Password

Post  Admin on Wed Jan 27, 2010 2:52 pm

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
avatar
Admin
Admin

Posts : 256
Join date : 2008-06-06

View user profile http://debmedia.forumotion.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum