Printer Object won't persist

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

I have a simple report that I would like my user to be able to assign a
printer to. I followed the example in
http://msdn.microsoft.com/en-us/library/bb258178.aspx and downloaded the DB.
The task seemed straightforward, but could not get my report to remember its
newly assigned printer. After several days of trial and error, I finally
noticed that the example DB does not have any code associated with some of
its reports (HasModule=No). My report does so I set that property to No for
testing and it works??? I then returned to the sample demo and sure enough it
doesn't work either if any report has any code linked to it.
Can anyone please explain, I need code behind my report?
Thanks!
 
Here's an alternative approach:
Printer Selection Utility
at:
http://allenbrowne.com/AppPrintMgt.html

The code creates a custom property on the report, so it can remember which
of the user's printers should be used for that report. The OpenTheReport()
funtction checks the property, sets the printer, opens the report, and then
restores the default printer.
 
Thanks Allen!
In fact I saw your alternative in several other posts. But the question
remains. Is this a know bug? If not, is there a solution?
 
Paul, I'm not sure I'd call this a bug.

If you open a report in *design* view, run:
Reports(0).Printer.Orientation = acPRORLandscape
then save, close, and open in preview, the setting is saved.

If you open the report in print preview, run the same line, and close, the
setting is not saved (though it is if you explicitly save before closing.)

I found no difference in behavior whether the report has a module or not.
For testing, I just used:
Private Sub Report_Open(Cancel As Integer)
Debug.Print Me.Name & " opened at " & _
Now() & " with orientation " & _
Me.Printer.Orientation
End Sub

The MSDN article does not really explain this well, but the behavior is
consistent with other report properties (such as Filter.)
 
Allen,
Thank you for taking the time to look at this in greater detail.

I don't understand why you don't see a problem with HasModule=yes. If you
could take a few minutes to repeat these steps, I am hoping you will see my
problem.

Instead of using my code, here is what I did and it exhibited the same
behavior.

-Download the PrinterDemo.mdb from the Microsoft site.
-Open the DB
-The Printer Demo form opens.


-In Select a Report click Catalog
-In Printer Demo, Click Preview
-In Printer Demo, Click Save Report Settings
-In the navigation window, right-click on Catalog and open it in Preview mode
-In the ribbon click Print, the Print dialog opens showing the selected
printer, all is good.
- Cancel the dialog

Change the printer in the Printer Demo Printer: combo box. and repeat the
above steps.
When you click Print from the ribbon, the Print dialog will show the newly
selected printer, all is good.


Now add an event to the Catalog report, all I did is:
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
End Sub

Change the printer back and repeat the steps above.
When you click Print from the ribbon, the Print dialog will contain the old
printer, not the newly selected one, happens every time.

Thanks!!!
Paul
 
Paul said:
I have a simple report that I would like my user to be able to assign a
printer to. I followed the example in
http://msdn.microsoft.com/en-us/library/bb258178.aspx and downloaded
the DB.
The task seemed straightforward, but could not get my report to
remember its
newly assigned printer. After several days of trial and error, I
finally
noticed that the example DB does not have any code associated with
some of
its reports (HasModule=No). My report does so I set that property to
No for
testing and it works??? I then returned to the sample demo and sure
enough it
doesn't work either if any report has any code linked to it.
Can anyone please explain, I need code behind my report?
Thanks!


Have you applied this hotfix to correct printer settings not being
saved?

http://support.microsoft.com/kb/950488

This hotfix allows changes to printer settings (including printer name)
to be saved both in the Page Setup dialog and in VBA code.


--
 
Thank you Michael!

No, I did not.
Here is my delimma. I had to load hotifix KB960715 (bloating issues) which
brings Access to 12.0.6334.5000. The hotfix you are suggesting is dated prior
to 960715. I read both hotfixes and there is nothing there to suggest that I
can't load them out of sequence, but I am uncomfortable doing this. Is it ok
to load older hotfixes on top of newer ones?
Paul
 
Paul said:
Thank you Michael!

No, I did not.
Here is my delimma. I had to load hotifix KB960715 (bloating issues)
which
brings Access to 12.0.6334.5000. The hotfix you are suggesting is
dated prior
to 960715. I read both hotfixes and there is nothing there to suggest
that I
can't load them out of sequence, but I am uncomfortable doing this. Is
it ok
to load older hotfixes on top of newer ones?
Paul


I don't think there is a problem loading hotfixes with earlier dates
unless
their documentation specifically says not to.

Hotfixes are unique fixes for unique problems that certain users
experience (maybe due to a unique HW or SW circumstances). They are not
like service packs or regular updates.

You might have to re-apply the 960715 hotfix after applying 950488 but I
would only do that if the issues involved in 960715 re-surfaced.

In any event I would create a restore point prior to applying 950488 so
you can easily
remove it if it doesn't fix the problem or causes a worse problem.


--
 
Hi Micheal,

Its taken some time, but this issue has finally raised to the top of my
prority list. I have been spending the day recapping this issue. I cannot get
this piece of code to get the printer to stick...

DoCmd.OpenReport "BottleTag", acViewDesign, , , acHidden
Set rpt = Reports("BottleTag")
Set prt = Application.Printers(Me!ComboBottleTagPrinter.Value)
rpt.Printer = prt
DoCmd.Save acReport, "BottleTag"
DoCmd.Close acReport, "BottleTag", acSaveYes

It always reverts to the Default printer. In desperation, I decided to load
the hotfix you suggested only to find out it is already loaded.

Can you or someone please explain what I am doing wrong?
Thanks,
Paul
 
Hi Micheal,

Its taken some time, but this issue has finally raised to the top of my
prority list. I have been spending the day recapping this issue. I cannot get
this piece of code to get the printer to stick...

DoCmd.OpenReport "BottleTag", acViewDesign, , , acHidden
Set rpt = Reports("BottleTag")
Set prt = Application.Printers(Me!ComboBottleTagPrinter.Value)
rpt.Printer = prt
DoCmd.Save acReport, "BottleTag"
DoCmd.Close acReport, "BottleTag", acSaveYes

It always reverts to the Default printer. In desperation, I decided to load
the hotfix you suggested only to find out it is already loaded.

Can you or someone please explain what I am doing wrong?
Thanks,
Paul
 
Back
Top