I have a query that I have been executing in VBA via the line "DoCmd.OpenQuery myQuery" in the code for a form. I've now modified the query so that it takes in two parameters but I'm stumped as to how to pass those parameters to the query. The parameters are not form controls, they are new values calculated within the form's code.
private sub cmdRunReport_Click()
Dim startDate, endDate as Date
'...Calculate values for startDate and endDate...
DoCmd.OpenQuery myQuery ' Query needs parameters...