Calling Access Query using DAO

Uncategorized — Titus Barik on March 20, 2006 at 10:26 pm

This example describes how to call a parameterized access query using Data Access Objects (DAO) from within Microsoft Access.

Dim db As Database
Dim rs As Recordset
Dim qdfParmQry As QueryDef

Set db = CurrentDb()
Set qdfParmQry = db.QueryDefs("qryStudents")
qdfParmQry("city") = "Atlanta"

Set rs = qdfParmQry.OpenRecordset()

Be sure not to confuse DAO with ActiveX Data Objects (ADO), the successor to DAO. While both technologies are nearing obsolescence, DAO continues to work well when specifically targeting a Jet database, as is usually the case with Microsoft Access.

0 Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

titus@barik.net | The Weblog of Titus Barik