You can make the query in the query designer, change the view of the designer to SQL and copy/past the sql in VBA
Or... keep the query as a query object and simply refer to it by name
Currentdb.Openrecordset("YourQueryName")
Only tricky part (can be) to get your parameters into the sql
Or... keep the query as a query object and simply refer to it by name
Currentdb.Openrecordset("YourQueryName")
Only tricky part (can be) to get your parameters into the sql