Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW CAN I SET A "SWITCH" ON A FORM TO FORCE USER TO PERFORM AN ACTION

Status
Not open for further replies.

Paul7905

MIS
Jun 29, 2000
205
US
I HAVE A FORM IN WHICH USERS ENTER TEMPORARY DATA INTO A TABLE.&nbsp;&nbsp;WHEN THEY EXIT THE FORM, I HAVE CODE THAT INVOKES A QUERY THAT WILL &quot;ZERO&quot; OUT THE ENTRIES THAT THEY HAVE MADE.&nbsp;&nbsp;BEFORE THEY EXIT THE FORM HOWEVER, THEY MUST PRINT A REPORT (WHICH IS INVOKED BY ANOTHER BUTTON ON THE FORM).&nbsp;&nbsp;I AM LOOKING FOR A WAY TO FORCE THE USER TO PRINT THE REPORT BEFORE EXITING THE FORM.&nbsp;&nbsp;I WAS THINKING THAT THE PRINT FUNCTION COULD SET A &quot;SWITCH&quot; TO A VALUE WHEN THE REPORT IS PRINTED; THE SWITCH COULD BE INTERROGATED FOR THAT VALUE IN THE EXIT CODE AND IF IT IS NOT SET, FORCE THE USER BACK TO THE FORM WITH A MESSAGE BOX.&nbsp;&nbsp;IS THIS FEASABLE AND DOES ANYONE HAVE IDEAS ON HOW I CAN DO THIS OR SOMETHING SIMILAR?&nbsp;&nbsp;(I THOUGHT ABOUT PRINTING THE REPORT AUTOMATICALLY IN THE EXIT ROUTINE BUT THIS IS NOT FEASABLE FOR REASONS I WON'T GO INTO HERE)<br><br>THANKS ~&nbsp;&nbsp;<br><br>PAUL
 
just a thought<br><br>in forms declatations sections place code<br>public toggle as string<br><br>in the forms on load or perhaps update event place code<br>toggle = &quot;ON&quot;<br><br>on the button they must push to print the report<br>place in the on click event<br>toggle = &quot;OFF&quot;<br><br>in the forms unload event place code<br><br>if toggle = &quot;ON&quot; then <br>msgbox &quot; Print report First&quot;<br>docmd.cancelevent<br>end if
 
Instead of bothering with a switch, why don't you disable the exit button.&nbsp;&nbsp;Then, when the report has printed, enable the exit button as in: me.cmdExit.enabled = true&nbsp;&nbsp;Of course, you will need to set the form's close button to 'no' on the properties. <p>-Chopper<br><a href=mailto: > </a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top