Newbie needs help writing Event Procedure

lstantliff

Registered User.
Local time
Today, 02:07
Joined
Apr 28, 2006
Messages
24
Hiya!
I am using Access 2000 and need to write an event procedure that tells a report to open the subreports within it upon open. I have attached a form to enter parameters for the reports, so my hope is that the form will provide the parameters for all the subreports. I have no idea how to write Visual Basic. I would appreciate any help I can get. My report is called RptAnnualProdSum, the form is called AnnualDialog and the subreports are AnnualReportHeading, RptAnnualDirect, RptAnnualIndirect, and RptAnnualSummary. They are in that order in the report. I need all reports to get their parameters from the form. There are 4 parameters [Forms]![AnnualDialog]![Plant], [Forms]![AnnualDialog]![Fiscal Year], [Forms]![AnnualDialog]![Dept], [Forms]![AnnualDialog]![Shift]. The OnOpen property in the report is set to open the form. Thanks for any help or direction anyone can give me. The form opens, I enter the parameter, press OK (which has a SetValue macro), then nothing happens!

Laura
 
You have a form that contains your report paramaters

create a button using the wizard to run your main report
Add all your sub reports to the main report

open the form fill in your parameters and click the button your main report will open and so will the sub reports (if they have any data in them)
 
I thought that is what I did, but it didn't work. I have two command buttons, OK and Cancel on the form. OK has a SetValue macro in the OnClick property. When you open the report, the form pops up, you enter the parameters and press OK - but then nothing happens. What have I missed?

Thanks!
 
When you create your button to run the reportthe following code is generated for you

Dim stDocName As String


stDocName = "YourReportname"
DoCmd.OpenReport stDocName, acPreview
 

Users who are viewing this thread

Back
Top Bottom