K
kitty
I have a subroutine where I would like to list the fields in a query
which resides in the database but I get an error: "Object variable as
woth block variable not set"
Code:
Public Sub test()
Dim db As Database
Dim qdf As QueryDef
Dim fld As Field
Set db = DBEngine.OpenDatabase("C:\Event.mdb")
Set qdf = db.QueryDefs("qrycodes")
For Each fld In qdf.Fields
Debug.Print fld.Name
Next fld
qdf.Close
db.Close
Set qdf = Nothing
Set db = Nothing
End Sub
Do you see anything I'm doing wrong in this code
which resides in the database but I get an error: "Object variable as
woth block variable not set"
Code:
Public Sub test()
Dim db As Database
Dim qdf As QueryDef
Dim fld As Field
Set db = DBEngine.OpenDatabase("C:\Event.mdb")
Set qdf = db.QueryDefs("qrycodes")
For Each fld In qdf.Fields
Debug.Print fld.Name
Next fld
qdf.Close
db.Close
Set qdf = Nothing
Set db = Nothing
End Sub
Do you see anything I'm doing wrong in this code