Difficulty in printing a report

JohnPapa

Registered User.
Local time
Today, 04:00
Joined
Aug 15, 2010
Messages
1,088
I use the following command to open a report called rptMedicalHistory

DoCmd.OpenReport "rptMedicalHistory", acViewPreview, , , acDialog

from a form that is also open in acDialog mode.

My problem is that once the report is open there is no way to print it, If I do a Control-P I have the option to print to PDF.

In the Ribbon Name of the report I have my report ribbon which does not show up.
 
In the Ribbon Name of the report I have my report ribbon which does not show up.
maybe there are errors when loading your ribbon.
you can Toggle Add-in error msg by going to Option->Client Settings->General->show add-in user interface error.
 
Have tried your suggestion. No result.
 
did you close and re-open it again?
if there is no error then your Ribbon has no error.
 
As I mentioned, I can output to PDF and print the PDF, but this is not user friendly.
did you close and re-open it again?
if there is no error then your Ribbon has no error.
Yes I reopened.
 
As I mentioned, I can output to PDF and print the PDF, but this is not user friendly.
if you have Installed a printer then your printer will show up when you press Ctrl-P.
 
You are right. The pc which I tested it is not connected to a printer.

Is there a way to show Control P somehow, making it more user friendly.
 
You can use:
Application.CommandBars.ExecuteMso ("PrintDialogAccess")
to expose and open the system Print Dialog to select printers
 
Is there a way to show Control P somehow, making it more user friendly.
you should first investigate why your ribbon is not showing.
maybe you already have the "Print" button there.
 
You can use:
Application.CommandBars.ExecuteMso ("PrintDialogAccess")
to expose and open the system Print Dialog to select printers
Your suggestion works as you indicate, but does not help in my case since my report opens in acDialog mode
 
Your suggestion works as you indicate, but does not help in my case since my report opens in acDialog mode
If I remove the acDialog parameter when opening the report, the report opens behind the form which called the report (The form is opened in acDialog) and I get the prompt for printing which prints the report, which does not show on the screen. It is behind the open form.

Is there a way to bring this report (when opened without acDialog) to the foreground? I tried setting the Focus to the report without success.
 
you may have "other" code After you opened the Report so it is losing focus when you open it.
add another code, after all code have run to SetFocus on the Report.

docmd.SelectObject acReport,"theReportNameHere",False
 
you may have "other" code After you opened the Report so it is losing focus when you open it.
add another code, after all code have run to SetFocus on the Report.

docmd.SelectObject acReport,"theReportNameHere",False
Did not work. Still in the background behind the forms.

These are the last 2 lines of code in the sub

DoCmd.OpenReport "rptMedicalHistoryTabularNew", acViewPreview
DoCmd.SelectObject acReport, "rptMedicalHistoryTabularNew", False
 
Your suggestion works as you indicate, but does not help in my case since my report opens in acDialog mode

Remove from your openreport parameters and in the report properties set popup and modal to true

in the report open event put the code

me.modal=false

so what should happen is the report opens on top because of the modal. But modal prevents changing focus to elsewhere (as acdialog does). Setting modal to false should enable you to access the print dialog
 
Remove from your openreport parameters and in the report properties set popup and modal to true

in the report open event put the code

me.modal=false

so what should happen is the report opens on top because of the modal. But modal prevents changing focus to elsewhere (as acdialog does). Setting modal to false should enable you to access the print dialog
The last statement in the form button click is
DoCmd.OpenReport "rptMedicalHistoryTabularNew", acViewPreview

In the report properties I set popup and modal to yes

In the Report Open I placed me.modal = false

The report opens on top, as in the case of using acDialog and the only way to print is to use Control-P

The report ribbon does not appear.
 
The report ribbon does not appear.
it will if your ribbon is "well" formed.
you can always upload your db for troubleshooting.
since going further we can only do wild guess.
 
I was suggesting you use
Application.CommandBars.ExecuteMso ("PrintDialogAccess")

as previously suggested
probably also in the report open event
 
Thanks, I put also command
Application.CommandBars.ExecuteMso ("PrintDialogAccess")

and it prompts to print. A step forward. Thanks
 
it will if your ribbon is "well" formed.
you can always upload your db for troubleshooting.
since going further we can only do wild guess.
The ribbon appears if I do not use acDialog when opening the report.

The ribbon also appears in other reports and it is being used for 20 years. The FE db is about 200Mb.
 
and it prompts to print. A step forward. Thanks
the Question now is "what" will it print?
if you open the Report via a button on a Form, the Form will get printed Not the report.
 

Users who are viewing this thread

Back
Top Bottom