devxlogo

Deleting a Record from the DBListBox

Deleting a Record from the DBListBox

Question:
How do I delete a record with the data I’ve selectedin a DBListBox (VB4.0). If I use the e.g. Findfirst command I get the message:

“The action was cancelled by an associated object.”
Would it be possible to use “SelectedItem” or “Bookmark”. If, then how?

Answer:
Since the DBListBox is the data source for the list, you can look at the Data.Recordset property, and use it like a Dynaset. For instance, if you wanted to delete the record from your box that had the word “Lego” from a field named “Name”, you could do the following:

Data.Recordset.FindFirst “Name = ‘Lego'”Data.Recordset.Delete
That should work without any problems.

See also  How to Avoid Money Transfer Scams  
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist