Clear Subform based on checkbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hulm1
    New Member
    • Mar 2008
    • 22

    Clear Subform based on checkbox

    I have made amazing progress using google and pinching code!.

    This one has me stuck though. I have a main form "Enquiry_Ed it". In the main form are several subforms which become visible based on a TRUE click on a checkbox "VapourExtracti on" with the following On Click code.

    The following is an example of one subform [EnquiryVacuumTy pe_Edit]

    Me![EnquiryVacuumTy pe_Edit].Form.Visible = Me.VapourExtrac tion

    This all works fine. BUT! When I uncheck the "vapourextracti on" check box, I want all the records in the subform to be cleared. ie I want the record delected (because the person entering it may have made a mistake or simply want to change it later and it may not be relevant to that enquiry anymore).

    For reference, the Primary key and first field of the subform is "VacuumType ID"
    The subform is linked as a child using the fields "EnquiryID" which is in both forms and is the Primary key of "Enquiry_Ed it".

    Each of the subforms has a variety of text boxes, check boxes, Combo Boxes and Option Groups. They all work fine.

    Because there are so many subforms, I would really like some nice small snippet of code!

    Thanks for any help in advance!
  • PianoMan64
    Recognized Expert Contributor
    • Jan 2008
    • 374

    #2
    Originally posted by Hulm1
    I have made amazing progress using google and pinching code!.

    This one has me stuck though. I have a main form "Enquiry_Ed it". In the main form are several subforms which become visible based on a TRUE click on a checkbox "VapourExtracti on" with the following On Click code.

    The following is an example of one subform [EnquiryVacuumTy pe_Edit]

    Me![EnquiryVacuumTy pe_Edit].Form.Visible = Me.VapourExtrac tion

    This all works fine. BUT! When I uncheck the "vapourextracti on" check box, I want all the records in the subform to be cleared. ie I want the record delected (because the person entering it may have made a mistake or simply want to change it later and it may not be relevant to that enquiry anymore).

    For reference, the Primary key and first field of the subform is "VacuumType ID"
    The subform is linked as a child using the fields "EnquiryID" which is in both forms and is the Primary key of "Enquiry_Ed it".

    Each of the subforms has a variety of text boxes, check boxes, Combo Boxes and Option Groups. They all work fine.

    Because there are so many subforms, I would really like some nice small snippet of code!

    Thanks for any help in advance!
    In order to begin to answer your question, I'm going to need to know some information about how you have the form designed, and the names of the controls, and the VBA code that you have behind the form to make it do what you're doing. It sounds like you've peaced this together without knowing how the peaces fit together.

    If you want, you can Zip the file, and attach it to one of your responses, and I'd be more than willing to check it out.

    Hope that helps,

    Joe P.

    Comment

    • Hulm1
      New Member
      • Mar 2008
      • 22

      #3
      Thank you very much indeed for replying. In fact this is now resolved, so I shall not need your assistance. Thanks anyway!

      Comment

      Working...