View Full Version : Passing Parameter to Query


williamk
04-11-2008, 11:59 PM
Hi all,

Using Access 2003. Really need some help. Have the below code which executes a SELECT query and passes the results as an excel spreadsheet attached to an email. Problem is that the query store_report has some parameters that need to be passed to it. Is there a way that with my current code I can pass those parameters. If not is there some other commands or code I can use to accomplish this?

DoCmd.SendObject acSendQuery, "store_report", acFormatXLS, _ "john@john.com", "c.w.k@gmail.com", , _ "Store Reports", "Here are your reports.", True


Thaniks in advance.

William K

boblarson
04-12-2008, 12:04 AM
I would suggest using a form for the parameters and have the query reference the form. I don't use parameter prompts from queries as they are too limiting, but I use forms almost all of the time to provide the criteria to queries.