View Single Post
  #2  
Old August 10th 06, 06:51 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to Open MS Access File

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


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


Using VBA, how do I open a Microsoft Access file from within Outlook.

Ads