Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / February 2006

Tip: Looking for answers? Try searching our database.

How do I create a button that prints 2 copies of a form?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Adam - Regus - 02 Feb 2006 15:48 GMT
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
Ted - 02 Feb 2006 17:48 GMT
First the simple answer:
Use a For...Next loop:
For x = 1 to 2
  print commands
Next x

Second: The best answer for your client (and what I do):
Create a form (with a table behind it) that holds user preferences.
In that form have a box where the user can select the number of copies
to print (default to 2).
Let the user change that number if they want to print more or fewer
copies.
Modify your For...Next loop to:
For x = 1 to DLookup("[Copies]", "tblUserPrefs")
  print commands
Next x

Ted

> 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
[quoted text clipped - 28 lines]
>
> Adam
Adam - Regus - 02 Feb 2006 20:41 GMT
Ted,

I'm not sure where in the code I should put the code:

For x = 1 to 2
  print commands
Next x

I would rather have the simple solution, as I'm not really a
programmer.  I'm more the guy who delivers the mail, who happens to
know a little something about computers....but not enough!

Thanks Again,

Adam
Dean - 04 Feb 2006 03:27 GMT
> 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
[quoted text clipped - 28 lines]
>
> Adam

I have not tried this solution but:

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
       DoCmd.PrintOut acSelection

Exit_PRINTFORM_Click:
   Exit Sub

Err_PRINTFORM_Click:
   MsgBox Err.Description
   Resume Exit_PRINTFORM_Click

End Sub
Lyle Fairfield - 04 Feb 2006 04:06 GMT
I am on the road. I have no printer. If I had a printer I would try:

Private Sub PRINTFORM_Click()
DoCmd.PrintOut
DoCmd.PrintOut
End Sub

But if I were designing the form there would be no button. I would tell
anyone who wanted two printed copies of the form to Click File > Print
and then to use the Spinner to select any number of copies needed.

What's worse than a Button that duplicates a method made available by
Access in a way that is consistent across almost all applications?
Can't guess? It's a Button that duplicates a method made available by
Access in a way that is consistent across almost all applications whose
Click Event has been scripted by a wizard.
"DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70" means
absolutely nothing to me; perhaps it's possible that in some
situations it may mean absolutely nothing to Access/VBA.

Eighty per cent of all poor code and practices can be traced to
Wizards. And Northwind is directly responsible for another eighty per
cent. The rest is attributable to the Help file.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.