Good morning all,
I have a form which allows me to delete some records from it but not all of them, with the latter producing an error 3200 The Record Cannot Be Deleted or Changed because table "tblMain' includes related records.
My database structure consists of 3 tables, with tblMain on the many side, and the other two tables on the one side.
I understand that I have to delete records from the Many side first, but that is what I am doing and deleting a record on the form
I have no problems accessing table tblMain directly and deleting the record.
What has me baffled is I can delete other records in tblMain via the form. But I cannot see a pattern on records I can delete and cannot
Note as well that the form I am deleting from is opened from another form where the ID's match
Parent Call Form
frmDistributionAddEdit
Any suggestions?
Many thanks
I have a form which allows me to delete some records from it but not all of them, with the latter producing an error 3200 The Record Cannot Be Deleted or Changed because table "tblMain' includes related records.
My database structure consists of 3 tables, with tblMain on the many side, and the other two tables on the one side.
I understand that I have to delete records from the Many side first, but that is what I am doing and deleting a record on the form
I have no problems accessing table tblMain directly and deleting the record.
What has me baffled is I can delete other records in tblMain via the form. But I cannot see a pattern on records I can delete and cannot
Note as well that the form I am deleting from is opened from another form where the ID's match
Parent Call Form
Code:
Private Sub Agent_Code_DblClick(Cancel As Integer)
Dim sID As String
Dim sForm As String
sForm = "frmDistributionAddEdit"
sID = "[ID] = " & [ID]
DoCmd.OpenForm sForm, , , sID, acFormEdit
End Sub
frmDistributionAddEdit
Code:
Private Sub cmdDelete_Click()
Dim iResponse As Integer
iResponse = MsgBox("Are you sure you want to delete this record?", vbYesNo, "Delete Operation")
If iResponse = vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
[Forms]![frmDistributionRegisterMain]![DistributionSUB].Form.Requery
End If
DoCmd.Close
End Sub
Any suggestions?
Many thanks