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

I'm trying to capture an after update event

Status
Not open for further replies.

Zygor

Technical User
Apr 18, 2001
271
US
of a field in a subform. If I use the subform as a form on it's own, the after update fires fine but not when it's used as a subform.

Any ideas?
 
The AfterUpdate event should work for fields on subforms. How are you updating the field? Have checked that AfterUpdate still says [Event Procedure], it can sometimes go missing :)
 
I have tried two different events

Public Sub txtFees_Exit(Cancel As Integer)
MyRoutine
End Sub

and

Private Sub txtFees_AfterUpdate()
MyRoutine
End Sub

Neither works in the subform. I am creating a total amount field on the main form. The subform has the various records so when when the fees field changes, or a new record is added and a fee in input, I want the total to reflect that.
 
There are quite a few events that do not fire if you update a control through code, AfterUpdate is one of them.
 
I'm not updating the field through code. I'm actually typing an amount in the field.
 
Just as a test, try adding an On Click event to the subform control with a message box. Does it work? If so, try steppinh through the After Update event.
 
The only events the subform have or on enter and on exit. When I go to the form itself I set up an on click event, but it doesn't fire when I click into it when it's a subform.
 
Oops. I meant subform, not subform control. I constantly use events on subforms, so I wonder if your database has become corrupt?
- Does the code compile?
- Have you tried compact and repair?
- Have you decompiled recently?

Do events work when you create a form and subform in a test database? I guess you checked that the event has [Event Procedure] against it in the property window?
 
Remou....before I continue. I want to thank you for your responses. I appreciate your thoughts.

So..
The code does compile
I did a repair and compact
I just started t make this database 21 hours ago. I have not decompiled, but doubt that will help. (I will not rule out doing it either) I just think it's something else
I did verify the event procedure is showing up in the events tab property window.

I'm reworking the form to avaoid using a subform. Maybe that will get me to the same place I need to be.
 
Where is MyRoutine located ? Which code in it ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top