C
Chris
My main form has subform [BCfrm]. The recorsource tables are related with
cascading deletes.
The user adds a record using DoCmd.GoToRecord , , acNewRec via a button and
then populates the main form, selects a service to promt the correct suborm
and populates it. Works fine. On the subform a control indicates the invoice
number that links it to the main form. I see it there...so doesn't that mean
the record is written in the related table?
I wish for the user to quit or abandon the entry via a Quit button. I can
only get the records (main and related) to delete when the user actually
enters data into the subform. They may wish to abandon before that.
So, the question is, how can I delete all related records, before an entry
(other than invoice number linked) into the subform? I have tried DoCmd Save
and several delete methods I've seen here. None work.
My code follows, with only one of several subforms indicated.
'allows each form to delete the record from its table.
Me.AllowDeletions = True
Me.BCfrm.Form.AllowDeletions = True
'turns off system messages
DoCmd.SetWarnings False
'deletes [tbl 2 Job] record and related tables' records
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
'turns system messages back on
DoCmd.SetWarnings True
Me.AllowDeletions = False
Me.BCfrm.Form.AllowDeletions = False
In hopes of guru help!
Thanks,
Chris
cascading deletes.
The user adds a record using DoCmd.GoToRecord , , acNewRec via a button and
then populates the main form, selects a service to promt the correct suborm
and populates it. Works fine. On the subform a control indicates the invoice
number that links it to the main form. I see it there...so doesn't that mean
the record is written in the related table?
I wish for the user to quit or abandon the entry via a Quit button. I can
only get the records (main and related) to delete when the user actually
enters data into the subform. They may wish to abandon before that.
So, the question is, how can I delete all related records, before an entry
(other than invoice number linked) into the subform? I have tried DoCmd Save
and several delete methods I've seen here. None work.
My code follows, with only one of several subforms indicated.
'allows each form to delete the record from its table.
Me.AllowDeletions = True
Me.BCfrm.Form.AllowDeletions = True
'turns off system messages
DoCmd.SetWarnings False
'deletes [tbl 2 Job] record and related tables' records
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
'turns system messages back on
DoCmd.SetWarnings True
Me.AllowDeletions = False
Me.BCfrm.Form.AllowDeletions = False
In hopes of guru help!
Thanks,
Chris