strangeryet
Programmer
In a previous thread we worked out reading through an Access table, but what do I need to do to modify this code to use a stored query as input rather than the table? Can it be done with DAO? Below is the table example:
Dim strTableName As String
Dim rs As DAO.Recordset
strTableName = "TableName"
Set rs = CurrentDb.OpenRecordset(strTableName, dbOpenDynaset)
Do While Not rs.EOF
MsgBox "Route " & rs.Fields("Tablefieldname")
MsgBox "Field Draw = " & rs.Fields("anotherTableFieldname")
' include processing here
'************************
rs.MoveNext
Loop
This code worked, but now I would like to use a stored query ('qryDailyStarts') instead of the table name. I tried to just change the tablename to the query name in hopes that Access would magically know what I wanted to do...this of course did not work!
Thanks
Dim strTableName As String
Dim rs As DAO.Recordset
strTableName = "TableName"
Set rs = CurrentDb.OpenRecordset(strTableName, dbOpenDynaset)
Do While Not rs.EOF
MsgBox "Route " & rs.Fields("Tablefieldname")
MsgBox "Field Draw = " & rs.Fields("anotherTableFieldname")
' include processing here
'************************
rs.MoveNext
Loop
This code worked, but now I would like to use a stored query ('qryDailyStarts') instead of the table name. I tried to just change the tablename to the query name in hopes that Access would magically know what I wanted to do...this of course did not work!
Thanks