I have a continuous subform that just has one combo box as a control (named docentTxt). It is designed to select facilitators who have went on the given event (which is in the main form). Here is the current table/relationship structure:
The Event Information table has Event_ID as the primary key and is what the main form is based on. The list of facilitators is in FacilitatorTable and has Facilitator_ID as the primary key. The FacilitationTable is what the subform is based on and links the events with facilitators with the following fields: Facilitation_ID (the table's primary key), Event_ID and Facilitator_ID.
As soon as I begin typing in the subform's combo box, a new entry is made in the FacilitationTable and the appropriate links are made based on which facilitator is chosen from the combo. That works fine and is great.
The problem is that if I delete the content of a combo box in the continuous form, that record still exists in the table--just blank in the Facilitator_ID field--and makes it so that there is a blank entry in the subform. Is there anyway that I can force Access to delete a record in the FacilitationTable if the combo box is blank after an update?
So far I have tried this, but it doesn't do anything:
Thanks.
The Event Information table has Event_ID as the primary key and is what the main form is based on. The list of facilitators is in FacilitatorTable and has Facilitator_ID as the primary key. The FacilitationTable is what the subform is based on and links the events with facilitators with the following fields: Facilitation_ID (the table's primary key), Event_ID and Facilitator_ID.
As soon as I begin typing in the subform's combo box, a new entry is made in the FacilitationTable and the appropriate links are made based on which facilitator is chosen from the combo. That works fine and is great.
The problem is that if I delete the content of a combo box in the continuous form, that record still exists in the table--just blank in the Facilitator_ID field--and makes it so that there is a blank entry in the subform. Is there anyway that I can force Access to delete a record in the FacilitationTable if the combo box is blank after an update?
So far I have tried this, but it doesn't do anything:
Code:
Private Sub DocentTxt_AfterUpdate()
If Me.DocentTxt = "" Then
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
DoCmd.RefreshRecord
End If
End Sub
Thanks.