By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,651 Members | 1,694 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,651 IT Pros & Developers. It's quick & easy.

How to determine If checkbox is checked on subform.

P: 9
I have a form with two sub forms. When I select a customer on form1, form2 displays details for that customer in ‘continuous’ form view.

In form2 I have a checkbox, with the code listed below in the “Before Update” event, which works perfectly when it is actually checked by the user.

I would now like to run the code from a Button on my main form. One button would auto check the check boxes. Then from another Button on the main form execute the below code on the records with checkboxes checked. Everything works fine when these buttons are triggered, except code below does not execute. What am I doing wrong? Any help would be appreciated. Thank you.

Expand|Select|Wrap|Line Numbers
  1. Private Sub OKToDeliver_BeforeUpdate(Cancel As Integer)
  2.  
  3. If Me.OKToDeliver = True Then
  4. Me.DeliveredUserID = lngMyEmpID
  5. Me.DeliveredDate = Now()
  6. Me.Signature.Value = SigPlus1.SigString
  7.  
  8. End If
  9.  
  10. Else
  11. If Me.OKToDeliver = False Then
  12. Me.DeliveredUserID = 0
  13. Me.DeliveredDate = Null
  14. Me.Signature = Null
  15.  
  16.  End If
  17.  
  18.  End Sub
Oct 2 '12 #1
Share this Question
Share on Google+
3 Replies


zmbd
Expert Mod 5K+
P: 5,287
subform controls: Me!Subform1.Form!Control_Name.value

Nested subform controls: Forms!Mainform!Subform1.Form!Subform2.Form!Control _Name.value

There are also the me, parent, and child shortcut references.
Oct 2 '12 #2

P: 9
Are you sugjesting that i format my code like this?

If Forms!FRS_Package_Maintenance!Packages.Form!OKToDe liver = True Then
Oct 2 '12 #3

zmbd
Expert Mod 5K+
P: 5,287
For code on the main form to know what is going on with the values of controls on the subforms then you will need to refer to those controls as I've given... the answer was based more against the title of your question vs. the posted code.

However, something that I'm wondering about is that your posted code appears to be in a "beforeupdate" event and not within an "onclick" event. The before update events only fire when a record is "dirty" and before the actual change is commited. This does not follow what the title of the thread...
Oct 2 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.