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

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> VBA For Printing, Access 2016    
 
   
hedge
post Oct 11 2018, 01:50 PM
Post#1



Posts: 477
Joined: 17-November 08



Hi,

when I use the code docmd.printout to print out the current object, it works perfect except for the fact that the user could still have a quick moment to cancel the print job.

Is there a way to have the object print, without the window popup to cancel come up, or is there a way capture if they do cancel the print job in VBA so I can have a code run if it does get canceled?

Thanks,
Go to the top of the page
 
GroverParkGeorge
post Oct 11 2018, 02:05 PM
Post#2


UA Admin
Posts: 34,142
Joined: 20-June 02
From: Newcastle, WA


Wrap it in a conditional statement that explicitly asks the user to confirm that they want the printout to be completed.

Something like

CODE
If MsgBox(Prompt:="Do you fer sure wanna print this?", _
    Buttons:=VbInformation + vbOkOnly, _
    Title:="Go Ahead and Print it?") = vbYes Then
     DoCmd.PrintOut
Else
    Your alternate code would go here
End If

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Visit My Blog on Facebook
Go to the top of the page
 
hedge
post Oct 11 2018, 02:14 PM
Post#3



Posts: 477
Joined: 17-November 08



Hi,

the problem with that is, after they say yes and it does print, another box comes up (I think that might be outside of access) that gives them an opportunity to cancel the print job.

I have a code that runs after the print, and for some reason if they cancel it that code doesn't run.

see extract code below - this part (DoCmd.RunMacro "inv_update_macro") doesn't run.

CODE
Response = MsgBox("The invoices have now been approved in the Database, Please make sure to print and save the Invoices, Print now?", vbYesNo + vbQuestion, "User Question")

If Response = vbYes Then

DoCmd.PrintOut


Else

End If

DoCmd.RunMacro "inv_update_macro"

Go to the top of the page
 
hedge
post Oct 11 2018, 02:16 PM
Post#4



Posts: 477
Joined: 17-November 08



I think I might have just solved my own issue,

move that last part of the code above the else?


-that did work - I moved the last command above the docmd.printout. ---

This post has been edited by hedge: Oct 11 2018, 02:30 PM
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    18th December 2018 - 09:19 PM