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

Getting a checkbox to activate its code 1

Status
Not open for further replies.

integritycare

Technical User
Mar 12, 2011
151
AU
Hello,
I would appreciate some help with this one please.
On a subform there is a checkbox which runs this code;

Code:
Private Sub Check2_AfterUpdate()
 If Check2 = True Then
Dim Rst As DAO.Recordset
Set Rst = Me.Recordset
With Rst
   .MoveFirst
   Do
      ACS = "Paid"
      .Edit
      ![ACS] = Me![ACS]
      .Update
      .MoveNext
      
   Loop Until .EOF
   
End With

End If
End Sub

I want to be able to put a checkbox on the mainform so that it will set the checkbox2 to true on the subform and run the code. Have tried several ideas, but can not get it to work.

Many thanks

Integrity
 
Hi Dhookom,

Many thanks for your reply.
How do call the after Update from code. Would you be able to give some advice on this please.

Regards,

Integrity
 
It isn't clear what you want to happen if the check box on the main form is true or false? It would also help if you posted the names of the check box on the main form as well as the subform control name.

You would need to change the after update from Private to Public and then call it like:
Code:
Private Sub chkOnMainForm_AfterUpdate()
    If Me.chkOnMainForm = True Then
        Me.sfrmIntCare.Form.Check2 = True
        Call Me.sfrmIntCare.Form.Check2_AfterUpdate
     Else
        Me.sfrmIntCare.Form.Check2 = False
    End If
End Sub

Duane
Hook'D on Access
MS Access MVP
 
Hi dhookam,

Many thanks for yoru reply. Yes I did some reasearch on the web. I found that the answer is what you have already given. Changing Private to Public was the answer... Again many thanks.

Integrity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top