Report based on SP w/ Parameter (Where does not work)

R

rm

I have a report based on a stored procedure. The stored procedure
contains 1 parameter, ID - long. I am trying to use docmd to open the
report an call the query. Each time I open the report I am prompted
for the ID.

The where condition on the docmd.open does not work ("[ID]="&
cstr(id)). I am still prompted for [ID].

How can I feed the stored procedure a paramter value in the open event
of the report.?
 
F

fredg

I have a report based on a stored procedure. The stored procedure
contains 1 parameter, ID - long. I am trying to use docmd to open the
report an call the query. Each time I open the report I am prompted
for the ID.

The where condition on the docmd.open does not work ("[ID]="&
cstr(id)). I am still prompted for [ID].

How can I feed the stored procedure a paramter value in the open event
of the report.?

Remove the criteria from the query so that the query returns all
records.

Then code a command button (on the form) click event:
DoCmd.OpenReport "ReportName", acViewPreview, , "[ID] = " Me.[ID]

where [ID] is the control on the form that displays the record ID you
wish to report on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top