borderAndreaVB free resources for Visual Basic developersborder
AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2017 Andrea Tincani
:: Delete Records using ADODB

Author  

David Costelloe

Language  

VB4, VB5, VB6

Operating Systems  

Windows 95, 98 and NT
Module

Public Const strJetProvider = "Provider=Microsoft.Jet.OLEDB.3.51;DataSource="C:\MyAccess.Mdb"

Usage

'* Delete a record from a Combo Box selection Using Access Database.
'* Put a Combobox and a Command Button on a form
'* Create an Access Database


Form_Load
    With Combo1
        .Clear
        .AddItem "David"
        .AddItem "Bob"
    End With
End Sub 

Public Sub Command1_Click()
    Dim MyConn As New ADODB.Connection
    Dim MySql As String

    With MyConn
        .ConnectionString = strJetProvider
        .Open
    End With
    MySql = "DELETE FROM SQL WHERE "
    MySql = MySql & " [Field] ='" & Combo1.Listindex(Combo1.List) & "'"
    MyConn.Execute MySql
'* no need for recordset
    MyConn.Close
    Set MyConn = Nothing

End Sub

:: Navigation

Home

Database Management

Previous Tip

Next Tip

:: Search this site
Google
:: Related Topics
icon 22-02-2010 Re: Execute dont work with vb6 and access 2000, why? by Anaru
icon 01-10-2007 Help with Image links in Db, please by wiseguy2004
icon 08-08-2007 Re: Button to save data to SQL Server by Bharathi
icon 06-04-2007 database visual basic 2005 by eira_ak
icon 20-03-2007 Re: db data -->vb in one by one data (using text botton in vb) by aak_neo
borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2017 Andrea Tincaniborder