Update Main Form from a Subform (1 Viewer)

DSimpson

New member
Local time
Today, 08:28
Joined
Apr 26, 2001
Messages
9
I am trying to requery a textbox on the main form by clicking in a checkbox control on a subform. The textbox counts the number of records on the subform that have the checkbox checked. I have it working by clicking a command button on the main form but I would like the requery to run every time a check one of the checkboxes.
 

charityg

Registered User.
Local time
Today, 08:28
Joined
Apr 17, 2001
Messages
634
can't you just put the same code in the onclick event of the check box?
 

DSimpson

New member
Local time
Today, 08:28
Joined
Apr 26, 2001
Messages
9
No, because the commandbox is based on a macro using the Requery command and it gave me an error when I tried to use it in the subform. I tried using the requery method in VB but it isn't giving the correct data (i.e. it doesn't update when the first checkbox is checked and when all boxes are unchecked it still thinks one is checked). Can someone there show me an example of code that may work?
 

charityg

Registered User.
Local time
Today, 08:28
Joined
Apr 17, 2001
Messages
634
try the afterupdate event of the checkbox
 

DSimpson

New member
Local time
Today, 08:28
Joined
Apr 26, 2001
Messages
9
Placing the requery code in the AfterUpdate event did NOT work, but using F9 does give the right results. However, I am trying to avoid an extra keystroke or click (i.e. I am trying to make the requery happen when the checkbox is clicked). I need to clarify the AfterUpdate event. It is working with one exception - it is always off by one. The first check does not change the count and the first uncheck does not change the count.

[This message has been edited by DSimpson (edited 05-03-2001).]
 

KevinM

Registered User.
Local time
Today, 08:28
Joined
Jun 15, 2000
Messages
719
ChkBox AfterUpdate Event

Forms!MainFormName!SubFormName.Refresh
Forms!MainFormName!TextBoxName.Requery

HTH
 

Users who are viewing this thread

Top Bottom