By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,704 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,704 IT Pros & Developers. It's quick & easy.

Multiple Select to Delete Records

P: n/a
What is the best way to delete multiple records selected from a list box?
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
If the listbox is listing the items contained in a field(s) of a table
(say tbl1), then these items would serve as the "Where" criteria to
delete from.

Docmd.RunSql "Delete * From tbl1 Where fldx = '" & list1.Column(0) & "'"

For multiple selections of a listbox do this

Dim v As Variant
For Each v In List1.ItemsSelected
Docmd.RunSql "Delete * From tbl1 Where fldx = '" _
& List1.ItemData(v) & "'"

Note: if the items in your listbox (list1 here) are text (or alpha
numeric) you have to delimit these items with single quotes (') inside
the sql statements as I have done. For Dates the delimeter is a #


*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.