PDA

View Full Version : Solved: Problem With Report Settings



joelwoo
04-24-2006, 12:22 PM
I have a report in my database that I have printing to a specific printer. I set this up using the page setup on reports. The report works fine once, but the second time that it is opened, it reverts to the default settings. The margins also change back to the default settings of 1 in. Here is the code I am using to print the report, as well as close the form/report that it is generated from. The really weird thing is that I run several other reports the same way, and don't have this issue.

DoCmd.Close
strDocName2 = "Pump Change Report"
DoCmd.OpenReport strDocName2, acViewNormal
DoCmd.Close acReport, strDocName2, acSaveNo
strDocName = "Pump Change Report"
DoCmd.Close acForm, strDocName

Please Help, thanks. :banghead:

OBP
04-25-2006, 04:57 AM
joelwoo, have you tried running that piece of code without the

DoCmd.Close acReport, strDocName2, acSaveNo

I do not think it is absolutely necessary to "close" a report as it closes itself when it finishes printing.

joelwoo
04-25-2006, 10:08 AM
I have the close command because the report is open for a preview so that the user can preview the report for accuracy before printing. I use the exact same code for other reports that operate in the same way and this is the only one that defaults back to defaults.

OBP
04-25-2006, 10:27 AM
There is something wrong here because
DoCmd.OpenReport strDocName, acPreview
is the corect VB for opening Report in Print Preview mode not
DoCmd.OpenReport strDocName2, acViewNormal

joelwoo
04-25-2006, 05:17 PM
I open the report for preview at a different time. This is just the code for closing the preview and printing the report after the user verifies it.

OBP
04-26-2006, 01:39 AM
I still think that you have a conflict with the print versus the print preview versions as I remember it happening to one of my reports, after previewing the report it changed back to default settings.
Have you tried just printing it without the preview to see if it still does it?

geekgirlau
04-26-2006, 07:05 PM
Alternatively, just preview the report and allow the user to print it manually from the preview screen.

joelwoo
05-01-2006, 09:11 AM
These are not smart people we are talking about. They aren't exactly computer literate. I found the answer in the Kbase though and you link in my other post helped alot.
Thanks