Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Combo and list boxes

Posted on 2000-05-15
2
Medium Priority
?
147 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 150 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…

916 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