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!

Form_AfterUpdate problem

Status
Not open for further replies.

franksirvent

Programmer
Mar 8, 2002
358
GB
Hi
I have a form and subform...

The form has only one field (a combo box)...

The problem is that when I am creating a new record, and I select a value from the form combo box, it runs the subform_Afterupdate routine.

I only want the subform_afterupdate to run ONLY when there is an "after update" on the subform.

Anyone knows how to go around this ???

I´ve checked the code and I don´t see why it triggers it..

Thanks in advance
 
Because when you change the combo box setting you UPDATE the combo box.

The sub Form control has the comboBox's bound field as its LinkMasterFields property so therefore the subForm control is UPDATED.

So therefore it does exactly want you've set it up to do - runs the code in the AfterUpdate event after it has been updated.



G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.

Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D

 
Thanks for your reply.

The thing is that what runs is the subform_update code, not the form_update code.

Is there a way I can run ONLY the subform_update code (when something changes on the subform) regardless what changes on the Main Form???
 
But the point I'm making is that something IS CHANGING on the subform - therefore the subForm's AfterUpdate event is being fired - rightly so.

When you change the combo box on the main form you change the dynaset that the subform is bound to.
Updating the combo box on the main form is, therefore, an update of the entire SubForm.




As a work around:
How about moving the AfterUpdate event in the subform into one ( or more ) of the subForm's own Controls ? Can you find a control that will conveniently activate the code that is currently in the subForm's AfterUpdate ?


'ope-that-'elps.


G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.

Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D

 
thanks for the info....
unfortuantely I cannot do what you are saying..

Basically the subform can contain as many records as you want, all linked to the Main Form.
Everytime you jump through to another record on the subform, I need it to check a couple of things before it goes ahead...so I assume AfterUpdate is the best routine to trigger it...

I don´t know...Access sometimes is very confusing...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top