Solved

Combo and list boxes

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 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…

789 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