Home Excel Powerpoint Word Outlook Error Codes

VBA Useful Codes

Welcome to the World of VBA
Home > VBAUsefulCodes

Connection With Access 2003 Database With VBA

Here is a VBA code for connecting MS Access Database (2003) with excel.

Sub ADO_Conn() 

Dim conn As New Connection 
Dim rs As New Recordset 

strcon = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ 
"Data Source=C:\sample.accdb;" & _ 
"User Id=admin;Password=" 

conn.Open (strcon) 

qry = "SELECT * FROM sampletbl" 
rs.Open qry, conn, adOpenKeyset 
Msgbox rs(0)

End Sub 


Enter your e-mail below and get notified on the latest blog posts.


VBA Outlook KPI Excel Alt+F11 Dashboards Macros Recording Graphs Automation Developer WaterFall Powerpoint Charts Pivot Tables Forecast Charts

Follow Us