Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Called macro from a form only executes the first command

Status
Not open for further replies.

3734kumo

Programmer
Mar 18, 2002
12
0
0
US
A button on my form executes a macro. In the Macro section, I entered a Macro Name say M1.
Under Action, I have the OpenForm & then filled in below the desired paramters. On the next line, I leave the 'Macro Name' blank and under 'Action' I have, say OpenReport with also the paramters filled in. The macro executes the first step only & then returns to the original form.

Both of these actions run correctly if called by difference 'Macro Names'. What am I doing wrong? What I want to do is pass a global paramter from the Form to the Report.
 
Your command button is on Form A. According to what you describe in the macro, you are asking it to open Form B and then open Report A. It sounds like you are giving mixed signals. When you click the cmdbutton, what action do you want performed?

Maurie
 
1. I have several reports which have the "Day of the Week" as a selection parameter. I want to use the same "Day Selector Form" with an Option Group, then pass the selected day (from the Option Group) to the Report. Each of these steps works OK independently but not as a group.

2. The buttons are for Reports A-C. For each button I want to execute the "Option Group" form & pass the selection to the desired report, A-C.

I hope this is clearer.
 
I think I have a an idea of what you are doing. You want to use an Option group to open specific reports. Not sure how to do with a macro (not that strong there) however, if you want to code, do the following in properties of each Option Button. On Got Focus, enter DoCmd.OpenReport "ReportDay",acNormal
Which ever option buttion has the focus, the report will open to what you indicate. Without trying to be to complacated, you could make a combobox or check boxes etc. They have the On Click event available, where the Option Group does not have.


acNormal will print or substitute acViewPreview to just preview report.

HTH

Maurie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top