T
Ted
in my a2k app, i have three tables:
IRB, Evaluations and Patients.
the PKs are as follows:
IRB = IRB Number
Evaluations = IRB Number, Date of Audit
Patients = IRB Number, MedRecNum, Date of Audit
in my relationships window, i have
IRB linked with Evaluations via a 1-to-many relationship on IRB Number
Evaluations linked with Patients via a 1-to-many relationship on IRB Number
and Date of Audit.
i have established referential integrity and enabled cascade delete and
update and my join type is the default.
i have a main form (parent) called 'Audit Report' that uses the IRB table
and two child/sub-forms on 'Audit Report' called 'Evaluations' and 'Patients'
which use their namesake tables.
i have placed three DELETE buttons on the form called 'Delete IRB', 'Delete
Audit' and 'Delete Patient'.
the code for the 2nd one (audit) is as follows:
Private Sub DeleteAudit_DblClick(Cancel As Integer)
On Error GoTo Err_DeleteAudit_DblClick
If vbOK = MsgBox("Be advised you are about to IRREVERSIBLY DELETE *ALL*
INFORMATION CONCERNING THIS AUDIT DATE (" & Forms![Audit
Report]![Evaluations].Form![Date of Audit] & ") FROM THE DATABASE!",
vbCritical + vbOKCancel + vbDefaultButton2, "SUPER HYPER ULTRA CRITICAL!!!")
Then
Me.AllowDeletions = True
RunCommand acCmdDeleteRecord
End If
Exit_DeleteAudit_DblClick:
Me.AllowDeletions = False
Exit Sub
Err_DeleteAudit_DblClick:
'Ignore "error" if user cancels delete; otherwise
' show the error message.
If Err.Number <> 2501 Then
MsgBox Err.description
End If
Resume Exit_DeleteAudit_DblClick
End Sub
to my (newbie) surprise, when i agreed to the 2ndary message reminding me
that 1 record in this table and all related records would be deleted, i found
that all records from all three tables were now deleted :-( what i had
expected to find was that the record having the Audit Date from the
Evaluations table and all records having the same Audit Date from the
Patients table would be deleted.
can anyone spot the achilees heel in all of this?
IRB, Evaluations and Patients.
the PKs are as follows:
IRB = IRB Number
Evaluations = IRB Number, Date of Audit
Patients = IRB Number, MedRecNum, Date of Audit
in my relationships window, i have
IRB linked with Evaluations via a 1-to-many relationship on IRB Number
Evaluations linked with Patients via a 1-to-many relationship on IRB Number
and Date of Audit.
i have established referential integrity and enabled cascade delete and
update and my join type is the default.
i have a main form (parent) called 'Audit Report' that uses the IRB table
and two child/sub-forms on 'Audit Report' called 'Evaluations' and 'Patients'
which use their namesake tables.
i have placed three DELETE buttons on the form called 'Delete IRB', 'Delete
Audit' and 'Delete Patient'.
the code for the 2nd one (audit) is as follows:
Private Sub DeleteAudit_DblClick(Cancel As Integer)
On Error GoTo Err_DeleteAudit_DblClick
If vbOK = MsgBox("Be advised you are about to IRREVERSIBLY DELETE *ALL*
INFORMATION CONCERNING THIS AUDIT DATE (" & Forms![Audit
Report]![Evaluations].Form![Date of Audit] & ") FROM THE DATABASE!",
vbCritical + vbOKCancel + vbDefaultButton2, "SUPER HYPER ULTRA CRITICAL!!!")
Then
Me.AllowDeletions = True
RunCommand acCmdDeleteRecord
End If
Exit_DeleteAudit_DblClick:
Me.AllowDeletions = False
Exit Sub
Err_DeleteAudit_DblClick:
'Ignore "error" if user cancels delete; otherwise
' show the error message.
If Err.Number <> 2501 Then
MsgBox Err.description
End If
Resume Exit_DeleteAudit_DblClick
End Sub
to my (newbie) surprise, when i agreed to the 2ndary message reminding me
that 1 record in this table and all related records would be deleted, i found
that all records from all three tables were now deleted :-( what i had
expected to find was that the record having the Audit Date from the
Evaluations table and all records having the same Audit Date from the
Patients table would be deleted.
can anyone spot the achilees heel in all of this?