Per "Big V said:
Can someone give me an example of how to call and execute a query in code
please ?
If you mean an existing query,
-----------------------------------------
Dim myQuery As DAO.QueryDef
Set myQuery = CurrentDB().QueryDefs("qryWhatEver")
With myQuery
.Parameters("theWhatever") = Whatever
.Execute dbFailOnError
End With
Set myQuery = Nothing
-----------------------------------------
OR
-----------------------------------------
Dim myRS As DAO.RecordSet
Dim myQuery As DAO.QueryDef
Set myQuery = CurrentDB().QueryDefs("qryWhatEver")
With myQuery
.Parameters("theWhatever") = Whatever
Set myRS = .OpenRecordSet, dbOpenDynaset
End With
With myRS
Do Until .EOF = True
'...
.MoveNext
Loop
End With
Set myQuery = Nothing
myRS.Close
Set myRS = Nothing