This one has me stuck
I have a main form "Enquiry_Edit". In the main form are several subforms which become visible based on a TRUE click on a checkbox "VapourExtraction" with the following On Click code.
The following is an example of one subform [EnquiryVacuumType_Edit]
Me![EnquiryVacuumType_Edit].Form.Visible = Me.VapourExtraction
This all works fine. BUT! When I uncheck the "vapourextraction" check box, I want the subform record to be deleted.
For reference, the Primary key and first field of one of the subforms is "VacuumTypeID"
The subform is linked as a child using the fields "EnquiryID" which is in both forms and is the Primary key of "Enquiry_Edit".
Each of the subforms has a variety of text boxes, check boxes, Combo Boxes and Option Groups. They all work fine.
I created a button on the main form and used the following code:
Me.EnquiryVacuumType_Edit.Form.Recordset.Delete
Me.EnquiryVacuumType_Edit.Form.Recordset.MoveNext
It works fine, but of course is not the point. I want the user to be able to check the box, make some entries on the subform and then if he/she changes his mind, they can simply uncheck the box and know that the record will be deleted.
Therefore I would like the above code to be based on an IF function such as:
if me.vapourextraction = false then
Me.EnquiryVacuumType_Edit.Form.Recordset.Delete
Me.EnquiryVacuumType_Edit.Form.Recordset.MoveNext
End if
It doesn't work though!
Because there are so many subforms, I would really like some nice small snippet of code!
Thanks for any help in advance!
I have a main form "Enquiry_Edit". In the main form are several subforms which become visible based on a TRUE click on a checkbox "VapourExtraction" with the following On Click code.
The following is an example of one subform [EnquiryVacuumType_Edit]
Me![EnquiryVacuumType_Edit].Form.Visible = Me.VapourExtraction
This all works fine. BUT! When I uncheck the "vapourextraction" check box, I want the subform record to be deleted.
For reference, the Primary key and first field of one of the subforms is "VacuumTypeID"
The subform is linked as a child using the fields "EnquiryID" which is in both forms and is the Primary key of "Enquiry_Edit".
Each of the subforms has a variety of text boxes, check boxes, Combo Boxes and Option Groups. They all work fine.
I created a button on the main form and used the following code:
Me.EnquiryVacuumType_Edit.Form.Recordset.Delete
Me.EnquiryVacuumType_Edit.Form.Recordset.MoveNext
It works fine, but of course is not the point. I want the user to be able to check the box, make some entries on the subform and then if he/she changes his mind, they can simply uncheck the box and know that the record will be deleted.
Therefore I would like the above code to be based on an IF function such as:
if me.vapourextraction = false then
Me.EnquiryVacuumType_Edit.Form.Recordset.Delete
Me.EnquiryVacuumType_Edit.Form.Recordset.MoveNext
End if
It doesn't work though!
Because there are so many subforms, I would really like some nice small snippet of code!
Thanks for any help in advance!