Hello,
I'm a hopeless newbee when it comes to writing VBA code; so I could really use your help.
All I want to do is write code to read in the results from an existing query. For the sake of example, my query is named "my-Qry"
Below is the code I've written; but when I try to run it, I get a compile error saying "External table name not defined" The error indicated that the compiler doesn't recognize "my-Qry"
Can someone PLEASE tell me what I'm doing wrong here?
Thanks in advance!
Jane
------Code Sample -------
Public Sub ReadQueryTable()
Dim db As DAO.Database
Set db = CurrentDb
Dim QryRs As DAO.Recordset
Set QryRs = db.OpenRecordset([my-Qry], dbOpenSnapshot)
Do Until QryRs.EOF
Debug.Print QryRs.Fields(0)
QryRs.MoveNext
Loop
End Sub
I'm a hopeless newbee when it comes to writing VBA code; so I could really use your help.
All I want to do is write code to read in the results from an existing query. For the sake of example, my query is named "my-Qry"
Below is the code I've written; but when I try to run it, I get a compile error saying "External table name not defined" The error indicated that the compiler doesn't recognize "my-Qry"
Can someone PLEASE tell me what I'm doing wrong here?
Thanks in advance!
Jane
------Code Sample -------
Public Sub ReadQueryTable()
Dim db As DAO.Database
Set db = CurrentDb
Dim QryRs As DAO.Recordset
Set QryRs = db.OpenRecordset([my-Qry], dbOpenSnapshot)
Do Until QryRs.EOF
Debug.Print QryRs.Fields(0)
QryRs.MoveNext
Loop
End Sub