Access handles
AllowEdits/AllowDeletions/AllowAdditions differently when you're dealing with a
form/subform situation.
The first thing you have to understand is that how these properties are set on the form
being used as a subform means absolutely nothing! If you run the form independently, they will perform as expected.
But if the form is used as a subform, they are completely ignored! The subform "container" is actually
a control on the main form, and as such, it is ruled by
how these properties are set on the main form.
If
AllowDeletions is set to
No on the main form, fields cannot be deleted on the main form
or on the subform. And to make things really confusing, since the subform is considered to be a control on the main form, if
AllowEdits is set to
No on the main form, records on the subform
cannot be deleted! This is true even if
AllowDeletions is set to
Yes on the main form ! That's because Access doesn't consider what you're doing as "
deleting a record" on the subform, but rather as trying to "
edit a field in a record" on the main form!
So, to summarize, to be able to delete a record in a subform, the
AllowEdits and the
AllowDeletions properties
both must be set to
Yes on the
main form.
If
AllowEdits and
AllowDeletions are set to
Yes on the main form, the next thing to consider is whether or not the main form can be edited. Not all forms can be edited; if a form is based on a non-editable (
Read-Only) query, then subform records cannot be deleted, regardless of how the mentioned properties are set on either form or subform. Allen Browne has a short article that explains why some queries are read-only:
http://allenbrowne.com/ser-61.html
Linq
;0)>