How to Open MS Access File

  • Thread starter Thread starter Guest
  • Start date Start date
Am Wed, 9 Aug 2006 12:41:53 -0700 schrieb DevDaniel:

Sample with ADO:

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset

Set cn = New ADODB.Connection
With cn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "D:\database.mdb"
.CursorLocation = adUseClient
.Mode = adModeShareDenyNone
.Open
End With

Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
Set .ActiveConnection = cn
.Open ("select * from [Tabellenname]")
End With

' close record and connection
rs.Close
cn.Close
 
Back
Top