command button that prints TWO copies of a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In access, I created a command button to print the current form. However, I
want it to print two copies (one for me, one for customer). I cannot get the
command button wizard to work, so I have no idea how to do it.
 
Amber,

This simplest way to do this is to just add another line to your existing vb
code.....

stDocName = "name of your report"
DoCmd.OpenReport stDocName, acNormal
DoCmd.OpenReport stDocName, acNormal

HTH,

Greg
 
Hi, Amber.
In access, I created a command button to print the current form. However, I
want it to print two copies

The easiest way to do this is to change the following line:

DoCmd.PrintOut
to:

DoCmd.PrintOut , , , , 2

Or, if you are creating an entirely new button and don't have the button
wizard, then the try the following code to print two copies of the current
form:

Private Sub PrintFormBtn_Click()
On Error GoTo Err_PrintFormBtn_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = Me.Name
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut , , , , 2
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_PrintFormBtn_Click:
Exit Sub

Err_PrintFormBtn_Click:
MsgBox Err.Description
Resume Exit_PrintFormBtn_Click

End Sub

.... where PrintFormBtn is the name of the button. Save the module and
compile the code.

To get the wizards working again, try selecting the "Control Wizards" button
on the Toolbox toolbar (looks like a magic wand dropping three, uh, rocks on
top of three elipses (...)).

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
Back
Top