Bill Andersen said:
In Access 2000 DAO, what is the syntax to refer to a field in an open
query?
I hope I'm not exposing my ignorance here, but I don't think you can get to
a field in an open query. What you want to do is create a recordset based
on that query, and then reference the field in that recordset.
You have to know either the name of the field, or which order it is.
If you know it is the third field, but not the name, you can do:
dim db as Database
dim rs as Recordset
dim strFieldName as String, iContents as Integer
set db=CurrentDB()
set rs=db.OpenrRecordset("My Query")
strFieldName=rs.Fields(3).Name
That gives you the field name. To reference that field:
iContents=rs(strFieldName)
If you already know the field name, "MyField", you can reference it :
iContents=rs!MyField