I have created a listbox to view/edit the records. I have a button whereby it serves to delete the record from the listbox. How to do that with written codes?Pls help…
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
delete record from listbox (a97)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » delete record from listbox (a97)
- This topic has 5 replies, 3 voices, and was last updated 22 years ago.
AuthorTopicWSnuglorious
AskWoody LoungerMay 6, 2003 at 9:13 am #387047Viewing 0 reply threadsAuthorReplies-
WSHansV
AskWoody LoungerMay 6, 2003 at 9:58 am #674016You will have to tell us a bit more about your setup.
1. Does your list box show a list of all records in a table (or query)?
2. If so, what is the bound column of the list box and to which field in the table (or query) does this column correspond? Is it a unique index in the table (or query)?
3. Can the user select multiple items in the list box?
4. Is suppose that by “delete the record from the listbox” you mean that you want to delete the corresponding record from the table (or query). Is that correct?If you provide enough information, somebody will be able to help you.
-
WSnuglorious
AskWoody LoungerMay 7, 2003 at 1:54 am #674348Im apologized for not providing more information. Alright, to answer your questions :-
1. Yes, the listbox which i created was unbound and shows a list of all records in a table
2. in the query table, i indicate all columns in groupby and it correspond with the unique number by search combo which i did not create primary key in my table. So the unique number that i use something like this ;(1,2,3…)
3. user can only select one items in the listbox because the listbox which i created for easy to do some modify the item when selected
4. yes, when after inputing some records and found that theres some errors in 1 or 2 records, users are allowed to delete direct from listbox which item is selected.I hope you have enough information that I have provide for you as per your request. Please do not hesitate to ask me if you want to know more. Im awaiting for your reply. Thanks for your help and hear from you soon.
-
WScharlotte
AskWoody LoungerMay 7, 2003 at 2:32 am #674354Sorry, but you can’t delete an item from a listbox in A97. What you can do is use code or a query to delete the selected item from the table and then requery the listbox. I didn’t understand whether you meant that the table did not have a primary key or the listbox did not contain the primary key. If the former, I don’t see how you expect to delete a specific record if you can’t identify it with a unique key. If the latter, you can add the primary key field to the listbox, make it the first column in the list, and set the column width of that column to zero.
-
WSHansV
AskWoody LoungerMay 7, 2003 at 11:13 am #674446To add onto what Charlotte wrote, the unique number you mention must be the first column in the list box; it may be hidden if you like by setting its column width to 0.
Let’s say that:
- The list box is named lstSelect
- The command button is named cmdDelete
- The table is named tblData
- The unique number field is named ID
[/list]The code to be executed when the user clicks the button would look like this:Private Sub cmdDelete_Click()
Dim strSQL As String
strSQL = “DELETE * FROM tblData WHERE ID = ” & Me.[lstSelect]
CurrentDb.Execute strSQL
Me.[lstSelect].Requery
End SubOf course, you must replace cmdDelete, lstSelect, tblData and ID by the names of the comand button, list box, table and field in your database.
-
WSnuglorious
AskWoody Lounger
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
DBOS Advanced Network Analysis
by
Kathy Stevens
1 hour, 59 minutes ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
2 hours, 42 minutes ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
4 hours, 39 minutes ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
5 hours, 21 minutes ago -
Some advice for managing my wireless internet gateway
by
LHiggins
1 hour, 51 minutes ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
6 hours, 16 minutes ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
14 hours, 8 minutes ago -
Sometimes I wonder about these bots
by
Susan Bradley
10 hours, 26 minutes ago -
Does windows update component store “self heal”?
by
Mike Cross
28 minutes ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
1 day, 4 hours ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
1 day, 3 hours ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
44 minutes ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
1 day, 6 hours ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
1 day, 6 hours ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
19 hours, 23 minutes ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
1 day, 14 hours ago -
0Patch, where to begin
by
cassel23
1 day, 8 hours ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
2 days, 4 hours ago -
89 million Steam account details just got leaked,
by
Alex5723
1 day, 16 hours ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
2 days, 13 hours ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
2 days, 4 hours ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
1 day, 15 hours ago -
Installer program can’t read my registry
by
Peobody
8 hours, 1 minute ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
2 days, 1 hour ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
2 days, 9 hours ago -
False error message from eMClient
by
WSSebastian42
3 days ago -
Awoke to a rebooted Mac (crashed?)
by
rebop2020
3 days, 9 hours ago -
Office 2021 Perpetual for Mac
by
rebop2020
3 days, 10 hours ago -
AutoSave is for Microsoft, not for you
by
Will Fastie
8 hours, 6 minutes ago -
Difface : Reconstruction of 3D Human Facial Images from DNA Sequence
by
Alex5723
3 days, 14 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.