Solved

Combo and list boxes

Posted on 2000-05-15
2
137 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now