close form after last textbox is entered

cadillac

Registered User.
Local time
Today, 08:41
Joined
May 9, 2001
Messages
34
i would like to close my form after the user enters the data into the last textbox on the form. i tried using the form's afterupdate event for this, but it will close itself when the focus goes to the subform in the middle of the form.

also when i use the code "DoCmd.OpenReport "all info1", [acViewNormal]"
can i set the "onclose" event in that report to do something?

as always,
thanks
 
Well, if you're very sure the user will not use the mouse to change the "last" field, then expect to go somewhere else on the form to change something else. (Silly users!) You could stick a

DoCmd.Close

in the "last" field's AfterUpdate event (not the Form's). The user will have to do something to exit this field after changing it - a tab or Enter, for example, or a click on another part of the form. Maybe it would be a better idea to put an explicit "Close" button on the form and, depending on your application, a "Save and Start New Record" button. Just a thought.

On your second question, there's no reason you can not "do something" on the OnClose event of a report. Without more information it's hard to say whether "something" is a good idea at that point, however.

HTH,
Jim
 
i want to run a query after the report runs. i wanted to know if i used that code, would the command still execute eventhough i didn't open the report to look at it i only printed it.
 

Users who are viewing this thread

Back
Top Bottom