Solved

Combo and list boxes

Posted on 2000-05-15
2
139 Views
Last Modified: 2010-05-02
I am new to visual basic programming.

I am connecting to a database using ado, using ADODBConnection and recordsets.

 In my application i am using a combo list box, and i can get all the information into the list box and i can add to the list box sucsesfully.

My problem is how do i delete from the list\datbase? I connect to the database, i select the record but how do i delete that record?

Whene using the delete command i get errors that i dont understand....
0
Comment
Question by:lompies
2 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2813217
you can delete using your ADODB.Connection object like this:

conn1.Execute "DELETE FROM myTable WHERE myField = 'myTextValue'"


where conn1 is your ADODB.Connection object

0
 
LVL 1

Accepted Solution

by:
manchula earned 50 total points
ID: 2813222
If you are using ado recordset, you can give, recordsetName.Delete

Here's a sample taken from Data Form Wizard:


Private Sub cmdDelete_Click()
  On Error GoTo DeleteErr
  With adoPrimaryRS
    .Delete
    .MoveNext
    If .EOF Then .MoveLast
  End With
  Exit Sub
DeleteErr:
  MsgBox Err.Description
End Sub

where, adoPrimaryRS is the ADODB Recordset.

For more information, use the Addin Data Form Wizard, which will give you the basic ideas.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question