Knowing which records are selected on a subform

aziz rasul

Active member
Local time
Today, 14:36
Joined
Jun 26, 2000
Messages
1,935
I have a subform (in datasheet view) with multiple records. On the main form I have a Delete button. I'm trying to find how I can detect which consecutive records are selected on the subform so that when I press the Delete button, they are all deleted.
 
Study; RELATIONSHIPS, Enforce Referential Integrity,
Cascade Delete related records.
 
But I want to delete SOME records on the many side whilst maintaining the primary record?

The attachment shows the relationships. It is the records in the "tblItemsUsedWastedLoaned" table that are to be deleted.
 

Attachments

Why not introduce a new field of type Yes/No in one of your tables referenced in the subform.
Then display it in the subform with the Title "Delete" or "Remove".
When the user clicks the command button "Delete" then execute a query or SQL to delete those records that are true.
Include "subform_name.Requery" after the SQL somewhere to refresh the subform data.

May want to include calling this function when the user closes the form just incase they don't click the command button 'DELETE'.

Cheap and Cheerful!
 

Users who are viewing this thread

Back
Top Bottom