UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> print button, option to select printer    
 
   
rdspollin
post Feb 3 2006, 03:38 AM
Post #1

UtterAccess Addict
Posts: 105



i have the following code for my print button:


Private Sub Workscope_Review_Report_test___PRINT_Click()
On Error GoTo Err_Workscope_Review_Report_test___PRINT_Click

Dim stDocName As String

stDocName = "Rpt: Cycle 0 Form"
DoCmd.OpenReport stDocName, acNormal

Exit_Workscope_Review_Report_test___PRIN:
Exit Sub

Err_Workscope_Review_Report_test___PRINT_Click:
MsgBox Err.Description
Resume Exit_Workscope_Review_Report_test___PRIN

End Sub


this is good but does not give me an option to select which printer i would like to send to. how to i make the print dialog box appear when this button is pressed?
Go to the top of the page
 
+
stimpo
post Feb 3 2006, 04:21 AM
Post #2

New Member
Posts: 13
From: Leek, UK



DoCmd.RunCommand acCmdPrint
Go to the top of the page
 
+
rdspollin
post Feb 3 2006, 04:54 AM
Post #3

UtterAccess Addict
Posts: 105



thanks for the reply. i like the avatar/profile pic. smoke me a kipper i'll be back for breakfast (IMG:http://www.utteraccess.com/forum/style_emoticons/default/wink.gif)

whereabouts do i put the 'DoCmd.RunCommand acCmdPrint' code?

i tried adding it after 'DoCmd.OpenReport stDocName, acNormal' but this still prints to my default printer before promoting me to print again

i tried replacing 'DoCmd.OpenReport stDocName, acNormal' with 'DoCmd.RunCommand acCmdPrint' but that just prints my form not the report
Go to the top of the page
 
+
kuifjexx
post Feb 3 2006, 04:57 AM
Post #4

UtterAccess VIP
Posts: 7,232
From: Belgium



Check this MS KB Article => How to automate the process of selecting the printer for a report in Microsoft Access

HTH

Greetz from Belgium (IMG:http://www.utteraccess.com/forum/style_emoticons/default/compute.gif)

Luc aka Kuifjexx
Go to the top of the page
 
+
stimpo
post Feb 3 2006, 04:59 AM
Post #5

New Member
Posts: 13
From: Leek, UK



you should have something like this.

docmd.openreport "report name", acviewpreview
docmd.runcommand accmdprint
docmd.close

That will open your report in preview mode, show the print dialog box and then close the report when you either print or cancel the print dialog box.
Go to the top of the page
 
+
rdspollin
post Feb 3 2006, 05:17 AM
Post #6

UtterAccess Addict
Posts: 105



kuifjexx, thanks for the link, looks useful!

stimpo, works perfectly, removed the last line 'docmd.close' so the report doesnt close after print or cancel

thanks for the help (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif)
Go to the top of the page
 
+
kuifjexx
post Feb 3 2006, 06:10 AM
Post #7

UtterAccess VIP
Posts: 7,232
From: Belgium



Glad we could help you

Greetz from Belgium (IMG:http://www.utteraccess.com/forum/style_emoticons/default/compute.gif)

Luc aka Kuifjexx
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 01:30 PM