Pass parameter to report on load (1 Viewer)

Johnmad86

Registered User.
Local time
Today, 19:11
Joined
Jul 15, 2013
Messages
36
Hi

I've been struggling with this issue for days now and I'm nearly there, but can't get the code working.

I have a report that pulls data from a crosstab query. The report works perfectly and prompts for a "StartDate" when it is run.

I need a form with a date field that can be selected. Then a command button which when pressed opens the report with the selected date passed as the parameter.

the code I have so far is in the on click event of the button:

DoCmd.OpenReport "rpt_12MonthlyInvoices", acViewPreview, , "StartDate=" & Me.txtStartDate

I was hoping that this would pass the txt.startDate field on the form to the report's "StartDate" when it is opened, but it is still prompting for the parameter when the report loads.

Am I missing something? Should I be using openArgs rather than the where clause? Or do I need to configure something in the "on load" event of the report also?

Thanks in advance
 

Users who are viewing this thread

Top Bottom