Need help refreshing form

Meanmyrlin

New member
Local time
Today, 11:47
Joined
Jan 9, 2008
Messages
9
I have a simple table called Condition that includes a check box column that changes the value from -1 when checked to 0 when unchecked.

I have a subform that feeds off and updates this table and includes all information available in the Condition table.

I am now creating a form (that contains the previously mentioned subform) with fields that are calculated based on values in the Condition Table. I want to use the checkboxes in the subform (from within the form) to include or exclude records from the calculations (mostly averages) that are made in the form. I have a query in the form that tells the form to only include records where the checkbox field is = -1. This query calculates the values of all fields in the form. The calculations work correctly but when you uncheck or check a records checkbox (thus excluding or including it in the calculations) nothing changes until you close and reopen the form. How do I make the form refresh automatically when one of the checkboxes is checked or unchecked. The after update function seems to be the answer but I cannot seem to apply it correctly. Does anyone know the code I would use to do this? I would like to apply it to the entire form as all fields in the form are based on these calculations.

Thank you in advance for your help.
 
From the after update event of the checkbox on the subform it would be:

To requery the subform:
Code:
Me.Requery

And to requery the main form:
Code:
Me.Parent.Requery
 
Thank you so much. This worked great and was so easy.

Thanks again.
 
You're welcome and also Welcome to Access World Forums. Sorry I missed sharing that before. :)
 

Users who are viewing this thread

Back
Top Bottom