Passing variables to stored procedure source

G

Guest

I have a report, that uses a stored procedure as a RecordSource, and uses the
InputParamters property to pass a date range to the stored procedure.

The report is launched from a form button. The form button passes the text
string for the InputParameters property by using the OpenArgs arguement of
the OpenReport method.

When the report displays, the dates have not changed. However, when I switch
to design view and then back to report preview, voila! There's the report
with the correct date range.

I'm wondering if this has something to do with the order of events? Does the
stored procedure run before the Report_Open() event fires? If so, is there
any other way to pass the parameters to the report earlier, or re-run the
stored procedure later?

Thanks!

Thanks!
 
G

Guest

I would create a query (pass through) and change the sql to run the SP with
the parameters just before I'm running the report, and base the report on
that query.
So I don't have to pass parameters to the report before opening it.

on the click on the button I would change the sql and then run the report.
I also like that method because I can view the records withou running the
report.
 
G

Guest

A pass-through query won't work because it's an .adp file. According to the
Access 2002 Enterprise Developer's Handbook (Sybex), you can't create SPT
queries in .adp files.
 
G

Guest

I guess what I'm really asking is this: What's the difference in <<events>>,
between clicking a button on a form that opens the report, like this:

DoCmd.OpenReport "r_Dispatch", acPreview, , , , strArguments

....and opening the report by switching back and forth between Design and
Print Preview?

The first method doesn't alter the date range. The second method does. Weird.
 

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