L
LB
Hi
The situation: to only allow subform record deletion if
there is more than one record in the recordset (i.e.
there must always be one record in the subform data).
I have used the form event BeforeDelConfirm, which works
fine, providing only one record from the subform is
selected:
- I check the number of records in the recordset (filter
based on key field data in main form).
- return the record count (unfortunately this record
count also includes the records that are being deleted).
- if the record count is less than or equal to 1, then I
set cancel = true, which cancels the record deletion (and
the MS Access 'delete record confirmation' prompt is not
displayed).
Solution: Either: I need to be able to return the number
of records that are being selected for deletion. OR: I
need to be able to check the recordset count after each
record deletion (the MS Access help topic infers that
this is possible ....."The Delete event occurs after each
record is deleted. This enables you to access the data in
each record before it's actually deleted, and selectively
confirm or cancel each deletion in the Delete macro or
event procedure. ")
Any help would be appreciated.
Thank you.
Regards LB
The situation: to only allow subform record deletion if
there is more than one record in the recordset (i.e.
there must always be one record in the subform data).
I have used the form event BeforeDelConfirm, which works
fine, providing only one record from the subform is
selected:
- I check the number of records in the recordset (filter
based on key field data in main form).
- return the record count (unfortunately this record
count also includes the records that are being deleted).
- if the record count is less than or equal to 1, then I
set cancel = true, which cancels the record deletion (and
the MS Access 'delete record confirmation' prompt is not
displayed).
Solution: Either: I need to be able to return the number
of records that are being selected for deletion. OR: I
need to be able to check the recordset count after each
record deletion (the MS Access help topic infers that
this is possible ....."The Delete event occurs after each
record is deleted. This enables you to access the data in
each record before it's actually deleted, and selectively
confirm or cancel each deletion in the Delete macro or
event procedure. ")
Any help would be appreciated.
Thank you.
Regards LB