Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   How to Open MS Access File (http://www.outlookbanter.com/outlook-vba/23389-how-open-ms-access-file.html)

DevDaniel August 9th 06 09:41 PM

How to Open MS Access File
 
Using VBA, how do I open a Microsoft Access file from within Outlook.

Michael Bauer [MVP - Outlook] August 10th 06 06:51 AM

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.



All times are GMT +1. The time now is 09:12 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com