PrintOut Code Error

  • Thread starter Thread starter Paul3rd
  • Start date Start date
P

Paul3rd

Hello,
I'm having a problem with a PrintOut command in my application.
The following code works correctly until I add the arguments for printing.
DoCmd.PrintOut works until I add acPages,1,1,acLow,1,False -
Then I get an error message saying the application can't find the form
"BNTEVal" referred to in a macro expression or Visual Basic Code.
Thanks in advance for any help.
Paul

Private Sub Test_Click()
On Error GoTo Err_Test_Click

Forms("BNTEVal").Printer.Orientation = acPRORLandscape
DoCmd.PrintOut acPages, 1, 1, acLow, 1, False
Exit_Test_Click:
Exit Sub

Err_Test_Click:
MsgBox Err.Description
Resume Exit_Test_Click

End Sub
 
Is BNTEVal the name of your form?

I know this does not answer your question, but I cannot think of a good
reason to print a form instead of a report. You can create a report to look
like your form. Then the code is:

DoCmd.OpenReport "rptReportName"

The page setup is done in the report and does not need to get passed through
the code. If you base your report off a query, then you do not have to
restrict the pages either. Just put criteria in your query to select the
record in the form you are on.

Hope this helps,
Jackie
 
Thanks Jackie,
I wanted to print out a blank form. I'll do as you suggested, base a report
on a query that does not return any values.
And then print that report.
Paul
 
Back
Top