Ask Experts Questions for FREE Help !
Ask
    mrsgwen90's Avatar
    mrsgwen90 Posts: 10, Reputation: 1
    New Member
     
    #1

    Oct 15, 2007, 12:33 PM
    print 2 copies of a report
    I have a form in Access that has a print receipt command button. Once this button is clicked it will print a receipt (which is actually created as a report). I want 2 copies of this to print when the print receipt button is click. Please take a look at the code I have to see what I need to do to be able to accomplish this.

    rivate Sub PrintRec_Click()
    On Error Go to Err_PrintRec_Click

    Dim rstTrans As New ADODB.Recordset
    Dim fld As ADODB.Field
    Dim strField As String
    Dim curCount As Currency

    rstTrans.Open "dbo_tbl_Transactions", CurrentProject.Connection, adOpenKeyset, adLockOptimistic

    If IsNull(Me.TempTransNumID.value) Then
    'this is new record
    rstTrans.AddNew
    Else
    'to stay on the record that was just inserted for editing
    rstTrans.Find ("TransNumID=" + Str$(Me.TempTransNumID))
    End If

    rstTrans!TransDate = Me.TransDate
    rstTrans!CustomerName = Me.CustomerName
    rstTrans!VehType = Me.VehType
    rstTrans!TktType = Me.TktType
    rstTrans!Auth_By = Me.AuthBy
    rstTrans!Quantity = Me.Quantity
    rstTrans!SHtkt1 = Me.SHtkt1
    rstTrans!SHtkt2 = Me.SHtkt2
    rstTrans!HRtkt1 = Me.HRtkt1
    rstTrans!HRtkt2 = Me.HRtkt2
    rstTrans!TransPayAmt = Me.TransPayAmt
    rstTrans!PaymentType = Me.txtPaymentType
    rstTrans!PaymentMethod = Me.cboPaymentMethod
    rstTrans!CheckNum = Me.CheckNum
    rstTrans!TransReceiptMemo = Me.TransReceiptMemo
    rstTrans!TransEntryTime = Now()
    rstTrans!TransEntryUserID = appUser

    If Me.cboPaymentMethod = "Check" And IsNull(CheckNum) Then 'Check number not entered
    MsgBox "You must enter a check no.", vbCritical, "Check Number Verification"
    CheckNum.SetFocus
    Exit Sub
    End If

    rstTrans.Update
    'this was a new record so update the form value of TransNumID for edit
    If IsNull(rstTrans!TransNumID.value) <> True Then
    Me.TempTransNumID = rstTrans!TransNumID.value
    End If

    whereClause = "NewQryShuttleHandiRideReceipt.TransNumID" & " = " & rstTrans!TransNumID

    /////here is where the receipt prints.

    DoCmd.OpenReport "RptShuttle HandiRide Receipt", acViewNormal, whereClause

    rstTrans.Close

    Set rstTrans = Nothing
    Me.cmdAddRec.Enabled = True

    Exit_PrintRec_Click:
    MsgBox "Record Successfully Saved! Printing Receipt."
    Exit Sub

    Err_PrintRec_Click:
    MsgBox Err.Description
    Resume Exit_PrintRec_Click

    End Sub
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #2

    Oct 15, 2007, 12:36 PM
    Quote Originally Posted by mrsgwen90
    /////here is where the receipt prints.

    DoCmd.OpenReport "RptShuttle HandiRide Receipt", acViewNormal, , whereClause
    If you ALWAYS want 2 copies, just run that command twice.
    mrsgwen90's Avatar
    mrsgwen90 Posts: 10, Reputation: 1
    New Member
     
    #3

    Oct 15, 2007, 12:59 PM
    Code twice or is there some kind of command that will tell it to run twice?
    mrsgwen90's Avatar
    mrsgwen90 Posts: 10, Reputation: 1
    New Member
     
    #4

    Oct 15, 2007, 01:05 PM
    Thank you.. I just copied the command again and it worked!!

    Thanks a bunch!
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #5

    Oct 15, 2007, 03:59 PM
    That's all that was necessary. There is a way to control the printer, but for 2 copies this was easier.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Many copies of the same email [ 14 Answers ]

I am receiving multiple copies of same email in my outlook inbox, Is there an easy fix?

Can I Get Copies Of Old Emails And Messenger [ 3 Answers ]

See My Other Posts I Need Help Please I Need To Know If My Wife Is Still Seeing This Guy And What Happened. She Has A Email Account And Msn Messenger Account But They Have Been Deleted All The Old Messages And Mails Is There Any Way I Can Get Them From Another Source? Are They Held On A Central...


View more questions Search