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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute code prior to leaving subform

Status
Not open for further replies.

XTnCIS

Programmer
Apr 23, 2002
57
US
I hope this isn't all backwards - I have to admit that this is my first sizeable programming in Access so I'm learning the ropes as it were. And just hopeing that I don't get my designs so screwed up that they give me grief down the road.

Problem: if the user changes data on the subform and then clicks on the main form I would like to have the subform do some tasks prior to getting back out to the main form.

I'm trying to use the On Exit event of the subform, but how do I call a procedure that is within the code of the subform (since the On Exit event is actually in the code of the main form).

I also had hopes that the On Current or Lost Focus events (which are within the subform) would do it for me, but these aren't fired-off when leaving a subform? What is?
 
---------------------------------------------------------
Don't overlook the On DIRTY event.
The Dirty event occurs when the contents of a form or the text portion of a combo box changes. It also occurs when you move from one page to another page in a tab control. Examples of this event include entering a character directly in the text box or combo box or changing the control's Text property setting by using a macro or Visual Basic.

To run a macro or event procedure when this event occurs, set the OnDirty property to the name of the macro or to [Event Procedure].

By running a macro or event procedure when a Dirty event occurs, you can determine if the record can be changed. You can also display a message and ask for edit permission.

The BeforeUpdate and AfterUpdate events for a record occur after you have entered the new or changed data in the record and moved to another record (or clicked Save Record on the Records menu), and therefore after the Dirty event for the record.

Don't forget the events associated directly withthe control that was edited. You don't have to wait til you leave the subform (form event) to take action.

Good Luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top