Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2016
    Posts
    1

    Print & Duplicate button

    I'm trying to add a button to a form that will print a report (called PRINTINVOICE), then duplicate the record into a new one, ideally the print dialogs should be hidden.

    The code i'm using to print the report is

    Code:
    DoCmd.OpenReport "PRINTINVOICE", acViewPreview,,,,acHiden
    Docmd.SelectObject acReport, "PRINTINVOICE"
    DoCmd.RunCommand acCmdPrint
    The code to duplicate is

    Code:
     DoCmd.RunCommand acCmdSelectRecord
        DoCmd.RunCommand acCmdCopy DoCmd.RunCommand acCmdRecordsGoToNew
        DoCmd.RunCommand acCmdSelectRecord
        DoCmd.RunCommand acCmdPaste
    
    Me.fieldtoblank = ""
    Is there a way to merge these 2 functions together, so i can run them from one button?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Code:
    sub btnPRINT_click()
    DoCmd.OpenReport "PRINTINVOICE", acViewPreview,,,,acHiden
    Docmd.SelectObject acReport, "PRINTINVOICE"
    DoCmd.RunCommand acCmdPrint
     DoCmd.RunCommand acCmdSelectRecord
        DoCmd.RunCommand acCmdCopy DoCmd.RunCommand acCmdRecordsGoToNew
        DoCmd.RunCommand acCmdSelectRecord
        DoCmd.RunCommand acCmdPaste
    Me.fieldtoblank = ""
    
    end sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 10-08-2015, 06:32 AM
  2. Replies: 6
    Last Post: 03-01-2014, 07:07 AM
  3. Replies: 4
    Last Post: 02-12-2014, 12:49 PM
  4. Print button quick print
    By xtrareal22 in forum Reports
    Replies: 1
    Last Post: 12-11-2013, 11:21 AM
  5. Replies: 0
    Last Post: 02-22-2011, 05:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums