Forum Discussion
Deleting records from a form in datasheet view when a sort has been applied to a combo-box.
https://1drv.ms/u/s!Avi7rxURRiAr0nujcRMuFri1fw_f?e=47PqwX
The db is read only in OneDrive so please download to test.
I am deleting records from the form in datasheet view by using the record selectors to highlight and select records, then either press keyboard Delete key or use Delete button in Records section of Ribbon Home tab.
If the form Data Property 'Order By' is blank (as at present) then records are deleted just from Table2 as I would expect. However, if you apply a sort to the form by using the arrow next to the column label and then delete records they are deleted from both Table1 and Table2, even though there is no defined relationship between the two tables.
I'll try it out later today, but I'm tied up for a few hours, sorry.
However, I see Arnel has joined the discussion; maybe he'll be able to respond quicker.
- AndyBentley-7653Aug 26, 2022Copper ContributorNo rush, I am now away for a long weekend. Not back till Tuesday.
Thanks.- George_HepworthAug 27, 2022Silver Contributor
See the previous response for an explanation which I believe accounts for this bug.
Here's an alternative that deletes one record at a time from the form, whether sorted or unsorted. There may be a way to delete all of the table 2 records using a similar technique. You can implement that if you wish.
- George_HepworthAug 26, 2022Silver Contributor
THis puzzles me. I have to do more research. I can't think of an explanation that explains this. Unfortunately, time is still a bit limited today.
However, I do see that the only control on the sample form is a combo box whose row source is table1. That implies the delete is actually operating against the records in the combo box as well as the form's recordsource.