Problem with Custom Toolbar when opening a report from code within a Form

C

cjmacs

I've created a custom print toolbar for my reports. As long as I open
the report by Double-Clicking the report name the custom toolbar opens
properly. The problem is when I open the reports from code. I created
a form to prepare the parameters and do calculations before opening the
report. I have a submit button on that form and prepares the
parameters in code and then opens the report with the following:

DoCmd.OpenReport "MonthlyBonusRpt", acPreview, , , acWindowNormal

When the report is opened from a form the toolbar will not display. If
I turn it on manually it does not seem to be associated to the report.
The zoom, close, etc do not work or close the entire application.

I used the DoCmd.ShowToolbar "CustomPrint", acToolbarYes -- No Luck

I tried the:

Report.Intem("MonthlyReport").Toolbar = "CustomPrint"

That did not work either.

Any hints?

Mac
 
S

SA

Add this code

DoCmd.ShowToolbar "CustomPrint", acToolbarYes

To the report's On Activate event and add a

DoEvents

after it. The DoEvents is the key to making it work.

Run the same code with acToolbarNo in the on deactivate or close event.
 

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