Solved

Combo and list boxes

Posted on 2000-05-15
2
142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
using Access 8 93
Sub or Function is not defined 6 59
VBA to find and replace multiline text from VBA modules 8 107
Collapse and expand table in Word 2010 2 159
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

738 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