If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How do I create a button that prints 2 copies of a form?
1. Adam - Regus
Feb 2, 10:48 am show options Newsgroups: comp.databases.ms-access From: "Adam - Regus" - Find messages by this author Date: 2 Feb 2006 07:48:20 -0800 Local: Thurs, Feb 2 2006 10:48 am Subject: How do I create a button that prints 2 copies of a form? Reply | Reply to Author | Forward | Print | Individual Message | Show original | Remove | Report Abuse I'm trying to create a button that prints 2 copies of a form. Using the wizard, I created a button that prints one automatically, using the following code: End Sub Private Sub CSR_BeforeUpdate(Cancel As Integer) End Sub Private Sub PRINTFORM_Click() On Error GoTo Err_PRINTFORM_Click DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection Exit_PRINTFORM_Click: Exit Sub Err_PRINTFORM_Click: MsgBox Err.Description Resume Exit_PRINTFORM_Click End Sub -------------------------------------END OF CODE---------------------------------------------------- So anyone know how I can get it to print 2 copies automatically? thanks for your help, Adam |
#2
|
|||
|
|||
How do I create a button that prints 2 copies of a form?
As posted very often in this newsgroup, it is not a good idea to print a
form. Forms are designed for data viewing, entry, and editing. A report is designed to print. It includes the appropriate controls and options needed to better control what prints. While this does not address how to get two copies, I'd suggest you build and use a report instead. -- Rick B "Adam - Regus" wrote in message oups.com... 1. Adam - Regus Feb 2, 10:48 am show options Newsgroups: comp.databases.ms-access From: "Adam - Regus" - Find messages by this author Date: 2 Feb 2006 07:48:20 -0800 Local: Thurs, Feb 2 2006 10:48 am Subject: How do I create a button that prints 2 copies of a form? Reply | Reply to Author | Forward | Print | Individual Message | Show original | Remove | Report Abuse I'm trying to create a button that prints 2 copies of a form. Using the wizard, I created a button that prints one automatically, using the following code: End Sub Private Sub CSR_BeforeUpdate(Cancel As Integer) End Sub Private Sub PRINTFORM_Click() On Error GoTo Err_PRINTFORM_Click DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection Exit_PRINTFORM_Click: Exit Sub Err_PRINTFORM_Click: MsgBox Err.Description Resume Exit_PRINTFORM_Click End Sub -------------------------------------END OF CODE---------------------------------------------------- So anyone know how I can get it to print 2 copies automatically? thanks for your help, Adam |
#3
|
|||
|
|||
How do I create a button that prints 2 copies of a form?
I found an old thread that might help you....
Printing more than one copy of a reportAll 3 messages in topic - view as tree Steve Arbaugh Jun 21 2002, 12:10 pm show options Newsgroups: microsoft.public.access.reports From: "Steve Arbaugh" - Find messages by this author Date: Fri, 21 Jun 2002 14:07:32 -0400 Local: Fri, Jun 21 2002 12:07 pm Subject: Printing more than one copy of a report Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse When you say print report button, I assume that this is a button on a form. Here's one way to do that; if you'd like to give your user's the ability to select a printer at the same time you might stop by our web site and look at our "On the Fly Printing" code which you can drop into your database and have your solution in about 5 minutes. But to print a couple of copy of a report from a button on a form use code like that below by signature. HTH -- Steve Arbaugh ACG Soft http://ourworld.compuserve.com/homepages/attac-cg --------------begin code------------------- Sub MyButton_Click () On Error Resume Next DoCmd.Echo False 'Turn off screen painting Docmd.SelectObject acReport, "MyReportName", True Docmd.PrintOut acPrintAll, , , , 2 'Print two copies Me.SetFocus 'return focus to the form Docmd.Echo True 'Turn on Screen painting End Sub "Cathy" wrote in message oft.com... - Hide quoted text - - Show quoted text - I require help with code to print two copies of a report when the print report button is selected. I am assuming the only way to do this is with VB code, but I am at a loss as to how to go about it. Any help is appreciated. Thank you. Cathy Jun 21 2002, 1:43 pm show options Newsgroups: microsoft.public.access.reports From: "Cathy" - Find messages by this author Date: Fri, 21 Jun 2002 12:40:04 -0700 Local: Fri, Jun 21 2002 1:40 pm Subject: Printing more than one copy of a report-HELP! Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse Thanks for the code Steve! I tried it and it worked fine. Unfortunately, however, I already have the following code for the Click event of that button to print the current record, rather than all records. I take it you cannot have both actions happening in the event because it ignored the first action and performed the second resulting in all the forms being printed on the report instead of the current one, but 2 copies were being printed. The code for the Click event is layed out like this: Private Sub PrintPO_Click() On Error GoTo Err_PrintPO_Click Dim stDocName As String Dim strWhereCondition As String strWhereCondition = "PONumberID = " & Me!PONumberID stDocName = "PO Fax Report" DoCmd.OpenReport stDocName, acViewNormal, _ WhereCondition:=strWhereCondition On Error Resume Next DoCmd.Echo False 'Turn off screen painting DoCmd.SelectObject acReport, "PO Fax Report", True DoCmd.PrintOut acPrintAll, , , , 2 'Print Two Copies Me.SetFocus 'Return Focus to the form DoCmd.Echo True 'Turn on screen painting Exit_PrintPO_Click: Exit Sub Err_PrintPO_Click: MsgBox Err.Description Resume Exit_PrintPO_Click End Sub Steve, if it is possible to perform both functions (print current record and print two copies) I suppose I have some syntax in the wrong order, or I am missing some code. Can you give me some advice on how to correct this? Thank you so much for your time. -----Original Message----- When you say print report button, I assume that this is a button on a form. Here's one way to do that; if you'd like to give your user's the ability to select a printer at the same time you might stop by our web site and look at - Hide quoted text - - Show quoted text - our "On the Fly Printing" code which you can drop into your database and have your solution in about 5 minutes. But to print a couple of copy of a report from a button on a form use code like that below by signature. HTH -- Steve Arbaugh ACG Soft http://ourworld.compuserve.com/homepages/attac-cg --------------begin code------------------- Sub MyButton_Click () On Error Resume Next DoCmd.Echo False 'Turn off screen painting Docmd.SelectObject acReport, "MyReportName", True Docmd.PrintOut acPrintAll, , , , 2 'Print two copies Me.SetFocus 'return focus to the form Docmd.Echo True 'Turn on Screen painting End Sub "Cathy" wrote in message news:f41501c21928$2acd5080 ... - Hide quoted text - - Show quoted text - I require help with code to print two copies of a report when the print report button is selected. I am assuming the only way to do this is with VB code, but I am at a loss as to how to go about it. Any help is appreciated. Thank you. . Steve Arbaugh Jun 22 2002, 4:54 am show options Newsgroups: microsoft.public.access.reports From: "Steve Arbaugh" - Find messages by this author Date: Sat, 22 Jun 2002 06:51:50 -0400 Local: Sat, Jun 22 2002 4:51 am Subject: Printing more than one copy of a report-HELP! Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse Cathy: Unfortunately, the two pieces of code are mutually exclusive unless you preview the report first. (So rather than using acViewNormal, use acViewPreview, which allows the filter to run, then use PrintOut.) Alternately you can use do OpenReports in a loop like this: For i = 1 to NumPrints '2 if that's what you desire doCmd.OpenReport "MyReport", acViewNormal DoEvents Next i Or if you are really adventurous, you would put the number of copies into the dmCopies element of the prtDevMode property, (a bit of coding is required). Our on the Fly Printnig code would do all of this with few lines of code like: Dim objPrint as New PrintClass With objPrint .ReportName = "PO Fax Report" .FilterSQL = "PONumberID = " & Me!PONumberID .Copies = 2 .PrintRpt End With HTH -- Steve Arbaugh ACG Soft http://ourworld.compuserve.com/homepages/attac-cg "Cathy" wrote in message news:10d1901c2195b$7106e1f0$9ae62ecf@tkmsftngxa02. .. - Hide quoted text - - Show quoted text - Thanks for the code Steve! I tried it and it worked fine. Unfortunately, however, I already have the following code for the Click event of that button to print the current record, rather than all records. I take it you cannot have both actions happening in the event because it ignored the first action and performed the second resulting in all the forms being printed on the report instead of the current one, but 2 copies were being printed. The code for the Click event is layed out like this: Private Sub PrintPO_Click() On Error GoTo Err_PrintPO_Click Dim stDocName As String Dim strWhereCondition As String strWhereCondition = "PONumberID = " & Me!PONumberID stDocName = "PO Fax Report" DoCmd.OpenReport stDocName, acViewNormal, _ WhereCondition:=strWhereCondition On Error Resume Next DoCmd.Echo False 'Turn off screen painting DoCmd.SelectObject acReport, "PO Fax Report", True DoCmd.PrintOut acPrintAll, , , , 2 'Print Two Copies Me.SetFocus 'Return Focus to the form DoCmd.Echo True 'Turn on screen painting Exit_PrintPO_Click: Exit Sub Err_PrintPO_Click: MsgBox Err.Description Resume Exit_PrintPO_Click End Sub Steve, if it is possible to perform both functions (print current record and print two copies) I suppose I have some syntax in the wrong order, or I am missing some code. Can you give me some advice on how to correct this? Thank you so much for your time. -----Original Message----- When you say print report button, I assume that this is a button on a form. Here's one way to do that; if you'd like to give your user's the ability to select a printer at the same time you might stop by our web site and look at our "On the Fly Printing" code which you can drop into your database and have your solution in about 5 minutes. But to print a couple of copy of a report from a button on a form use code like that below by signature. HTH -- Steve Arbaugh ACG Soft http://ourworld.compuserve.com/homepages/attac-cg --------------begin code------------------- Sub MyButton_Click () On Error Resume Next DoCmd.Echo False 'Turn off screen painting Docmd.SelectObject acReport, "MyReportName", True Docmd.PrintOut acPrintAll, , , , 2 'Print two copies Me.SetFocus 'return focus to the form Docmd.Echo True 'Turn on Screen painting End Sub "Cathy" wrote in message news:f41501c21928$2acd5080 ... I require help with code to print two copies of a report when the print report button is selected. I am assuming the only way to do this is with VB code, but I am at a loss as to how to go about it. Any help is appreciated. Thank you. . End of messages -- Rick B "Adam - Regus" wrote in message oups.com... 1. Adam - Regus Feb 2, 10:48 am show options Newsgroups: comp.databases.ms-access From: "Adam - Regus" - Find messages by this author Date: 2 Feb 2006 07:48:20 -0800 Local: Thurs, Feb 2 2006 10:48 am Subject: How do I create a button that prints 2 copies of a form? Reply | Reply to Author | Forward | Print | Individual Message | Show original | Remove | Report Abuse I'm trying to create a button that prints 2 copies of a form. Using the wizard, I created a button that prints one automatically, using the following code: End Sub Private Sub CSR_BeforeUpdate(Cancel As Integer) End Sub Private Sub PRINTFORM_Click() On Error GoTo Err_PRINTFORM_Click DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection Exit_PRINTFORM_Click: Exit Sub Err_PRINTFORM_Click: MsgBox Err.Description Resume Exit_PRINTFORM_Click End Sub -------------------------------------END OF CODE---------------------------------------------------- So anyone know how I can get it to print 2 copies automatically? thanks for your help, Adam |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Create a button on a Form to Close current database and open anoth | Sondra | Using Forms | 0 | December 29th, 2005 04:07 PM |
Move feild entries from form to form using global variables | JackCGW | General Discussion | 11 | November 14th, 2005 05:22 AM |
Requerying a pop up form to display in the main form | Jennifer P | Using Forms | 13 | April 5th, 2005 06:59 PM |
Need to clear controls of Filter form | Jan Il | Using Forms | 2 | November 28th, 2004 02:04 PM |
reset button, create excel, import table, send e-mail, create back-up | matthew nance | General Discussion | 0 | July 27th, 2004 06:52 PM |