I have a form frmEntryTabbed (allows the user to enter fields in tblEntry) and a subform frmEntry_subform (allows the user to enter fields in tblShowClassEntry). I have a button on frmEntryTabbed that deletes the current record in tblEntry.
Code:
Private Sub cboDeleteEntry_Click()
On Error GoTo Err_cboDeleteEntry_Click
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
Exit_cboDeleteEntry_Click:
Exit Sub
Err_cboDeleteEntry_Click:
MsgBox Err.Description
Resume Exit_cboDeleteEntry_Click
End Sub
Before deleting the record I would like to check the value in a related table. The basic layout of the tables is as follows:
tblEntry
EntryNum_pk
RiderNum_fk
HorseNum_fk
tblShowClassEntry
EntryNum_fk
PlacingNum_fk
tblPlacement
PlacementNum_pk
PlacementNumerical
Placement
For each entry there may be multiple classes entered. If any of the classes entered has a value in PlacinNum_fk not equal to 7, I want to display a message and not allow the record to be deleted.
Any help will be appreciated. Thank you