Delete multiple rows in one step (1 Viewer)

sibbbra

Member
Local time
Today, 11:59
Joined
Feb 11, 2022
Messages
78
When I select multiple rows I want my delete button in the form to delete all the records I have selected. It just ends up deleting the row selected at first.
That doesn't choose all the selected entries. Any way to select all rows and delete in a single step. SQL is as:

SELECT [Line gen].Order_ID, [Line gen].Order_Date, [Line gen].Customer_ID, [Line gen].Voucher_ID, [Line gen].Customer_Name, [Line gen].Delete
FROM [Line gen];

kindly help !
 
If I understand you correctly, it's like this
Code:
Dim sVal$
    sVal = "Delete FROM [Line gen] WHERE ([Line gen].[Delete]=True);"
    CurrentDb.Execute sVal
 
are the records you want to delete in subform?
you can add timer to your subform to save the current PK number and the SelHeight (number of selected).
add 1 hidden textbox to your main form.

on the subform's timer event, save the pk(s) selected rows to the hidden textbox.

see this demo.
 

Attachments

That's an interesting demo Arnel, but isn't that limiting using a datasheet instead of a listbox where you could make multiple selections anywhere in the list first? The current subform only allows contiguous records to be selected.
 
That's an interesting demo Arnel, but isn't that limiting using a datasheet instead of a listbox where you could make multiple selections anywhere in the list first? The current subform only allows contiguous records to be selected.
the OP did not mention any listbox.
i think it is fairly easy if that is the case.
 
The other way would be to mark the selected records with a checkbox in a regular form.
 
are the records you want to delete in subform?
you can add timer to your subform to save the current PK number and the SelHeight (number of selected).
add 1 hidden textbox to your main form.

on the subform's timer event, save the pk(s) selected rows to the hidden textbox.

see this demo.
thanx but there is error comin at
CurrentDb.Execute sVal
 
If you had started by publishing an example, there would have been a solution a long time ago...
...
Here you are.
Thanx !
I have no proper words to thank u. and how can I select all the checkboxes with say a button, What should I do?
 
But when I filtered the results based on criteria in query, all records are selected, instead of filtered ones, how to achieve that...I just want to delete the filtered and thenselected results. plz
 

Attachments

Users who are viewing this thread

Back
Top Bottom