change query using macro in access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I send several reports to several different people on a daily basis. I would
like to set up a macro to change the criteria in the queries that I have set
up. I know that I can set up the criteria to ask me for the information, but
I am looking to automate some of the process. Any help would be much
appreciated.

Thanks.
 
Not sure it's possible using a macro. It's fairly straight-forward using
VBA, though.

Assuming you've got a stored query named qryMyQuery, and you know that your
SQL should be what's in variable strSQL, you can change the query using:

CurrentDb().QueryDefs("qryMyQuery").SQL = strSQL
 
Back
Top