Name
querydef.OpenRecordset([Type], [Options]), [LockEdits])
Synopsis
Opens the record.
|
Argument |
Description |
|---|---|
|
|
The type of recordset to open: |
|
|
A combination of constants that specify characteristics of the recordset. See DAO Help for more information about these options. |
|
|
The locking used by the recordset: |
The following code example displays the contents of the recordset produced by the Invoices query in the Northwind Traders sample database on the active sheet:
Dim strDbPath As String
Dim db As DAO.Database
Dim qry As DAO.QueryDef
Dim rs As DAO.Recordset
Dim qt As QueryTable
strDbPath = "C:\Program Files\Microsoft Office\OFFICE11\SAMPLES\Northwind.mdb"
Set db = OpenDatabase(strDbPath)
Set qry = db.QueryDefs("Invoices")
Set rs = qry.OpenRecordset
Set qt = ActiveSheet.QueryTables.Add(Connection:=rs, _
Destination:=ActiveSheet.Range("A1"))
qt.RefreshBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access