Update unrelated form in main form

tscotti

Registered User.
Local time
Today, 12:33
Joined
Aug 15, 2004
Messages
47
Hi,

I have a "products" main form that contains three subforms.

The first subform displays "opening inventory" information and the second subform displays "transactions".

The third and last subform displays a running total of additions and subtractions from records in the first two forms. This third form is based on an elaborate calculation query and is not related to the other subforms.

My problem is that I can't find a way of updating the third unrelated subform when any record changes in the first two subforms.

The only way the third subform is updated is when I change records on the main form.

Any help offered is greatly appreciated.

Tony
 
you need to requery the third subform when data changes in the mainform or the 1st subform. try doing this in the after update event of the main form and 1st subform.

Don't forget to fully qualify the name

ie Forms!MyMainForm!mySubform.requery
or you amy need to use this notation
Forms!MyMainForm!mySubform.form.requery
 
Thanks for responding.

I keep getting the message "Form not found" when trying any qualifying name! :confused:
 
Have you replaced
Code:
Forms![COLOR="Sienna"]MyMainForm!mySubform[/COLOR].Form.Requery
with the actual names of your forms?
 
Lagbolt,

Are you kidding?

I may not be an Access expert but this much I know. :)

Regards,

Tony
 
And a slight variation that might have slipped by:
Code:
Forms!MyMainForm!mySubform.Form.Requery
will only work if the subform control is named the same as the subform. If you used the wizard to place the subform on the main form that will be the case, but if you didn't, then the liklihood is that the subform CONTAINER on the main form is named something like ActiveXCtl3 and IT is the thing that needs to be referenced in the code lagbolt posted.
Code:
Forms!MyMainForm.ActiveXCtl3.Form.Requery

But, I was playing around with things on another database and it would appear that this might be the more proper syntax:
Code:
Forms!YourMainFormName.Form.YourSubformName.Requery
with the .Form. before the subform name when using .requery and not a control.
 
Spot on Bob!

I like to prefix my forms with "frm" and I just checked the control name of the subform of the main form and, as you said, the name is different - no prefix!

I corrected it and it works.

Thank you very much Bob and Lagbolt for your help.

Much appreciated,

Tony
 

Users who are viewing this thread

Back
Top Bottom