Carl Smith Posted May 23, 2005 Posted May 23, 2005 I have chosen to print records from a separate file and offer the Print Setup (Windows) to the user - to offer them a choice of printer. If the user cancels the Print Setup Dialog how can I get him back to his original layout? Hope someone can help.
aaa Posted May 23, 2005 Posted May 23, 2005 Alow User Abort[off] Set Error Capture[on] Print[] Go to layout[original layout]
Carl Smith Posted May 23, 2005 Author Posted May 23, 2005 Thanks for your reply. This stops the Error Dialog (Continue/Cancel) but when I choose to cancel but I still end up with a printed copy because of the Print script step (presumably). That's what I'm trying to avoid so if the user selects the cancel option the script is "stopped" and is then returned to their original layout.
Vaughan Posted May 23, 2005 Posted May 23, 2005 User cancelled action is Error 1. So... Alow User Abort[off] Set Error Capture[on] Print[] Set Field [ gError, Status( CurrentError ) ] Set Error Capture[off] If [ gError = 0 ] # Print was successful. <stuff to do when print happens> Else If [ gError = 1 ] # User cancelled action. Go to layout[original layout] Else # Some other error has occurred. End If End If I prefer to put the error code into a global number field (gError) so it can be used later (the CurrentError variable gets reset after each script step processes, even comments).
aaa Posted May 24, 2005 Posted May 24, 2005 Now i tried my suggestion in my PC.If understood you truly - it does what you want.See attachment. Press print button, then choose cancel. print.zip
Carl Smith Posted May 24, 2005 Author Posted May 24, 2005 Thank you Vaughan. This is perfect and I am extremely grateful.
doughogg Posted May 26, 2005 Posted May 26, 2005 Alow User Abort[off] Set Error Capture[on] Print[] Go to layout[original layout] ... Now i tried my suggestion in my PC. If I understood you truly - it does what you want. See attachment. Press print button, then choose cancel. Your method above worked perfectly for me. In response to the earlier comment about this method, it does not print after hitting "Cancel" because that "Cancel" button is for printing. (Cancel for the script is suppressed by the steps above.) The script then continues and takes the user back to the original layout. This was short and sweet which is what I needed in my client's office at 2 am. Thanks. The other solution looks great for situations that are more complex than mine.
Recommended Posts
This topic is 7124 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now