Print Form Page - Only One

N

Novice2000

Hi,

I would like to have a button that prints just the page of the form that you
are viewing. Below is the basic. How can I change it to have it print only
one page? Thanks.

Private Sub PrintScreen_Click()
On Error GoTo Err_PrintScreen_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "Baylor_2008"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_PrintScreen_Click:
Exit Sub

Err_PrintScreen_Click:
MsgBox Err.Description
Resume Exit_PrintScreen_Click

End Sub
 
D

Douglas J. Steele

Forms aren't intended for printing: that's what Reports are for.

If you insist on printing a form, though, the PrintOut method allows you to
specify specific pages:

DoCmd.PrintOut acPages 1, 1

will print just the first page.
 
N

Novice2000

This gives me a "Compile" error.



Douglas J. Steele said:
Forms aren't intended for printing: that's what Reports are for.

If you insist on printing a form, though, the PrintOut method allows you to
specify specific pages:

DoCmd.PrintOut acPages 1, 1

will print just the first page.
 

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