Debmedia Creation Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

VB Access Data Con with Password

Go down

VB Access Data Con with Password Empty VB Access Data Con with Password

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

Posts : 256
Join date : 2008-06-06

https://debmedia.forumotion.com

Back to top Go down

Back to top


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