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