in access calling a stored procedure in sql server
Hi all,
I have a report that I want to run from a form.
Background:
I created a stored procedure in SQL Server and it has two parameter values: Month (int) and year (int). I created a pass through query in Acess that executes the stored proc with the two parameter values I supplied:
EXECUTE spM_bodies_and_units_detail_rpt 10, 2005
This works and the report works. Now the issue I have is that I want the pass through query to take two parameter values from two fields on the form:
[forms]![frmReportMenu]![txtMonth]
[forms]![frmReportMenu]![txtYear]
I have tried the following in the pass through query:
EXECUTE spM_bodies_and_units_detail_rpt [forms]![frmReportMenu]![txtMonth], [forms]![frmReportMenu]![txtYear]
this gives me an error:
ODBC--call failed
Incorrect syntax near '!'. (#170).
Has anyone tried this? I was hoping someone might have an idea. Thanks for any help on this.