Deleting Record Using Button

C

CK

I was looking for code to place in my button so that on clicking it, it will
delete the record based on a listbox. Someone gave me this code which worked
perfectly but now I'm trying to use the same code on another form, I get an
error:

Run-time error '3061':
Too few parameters. Expected 1.

It's funny because it worked great on the other form. THe code is:

Private Sub MyButtonName_OnClick
Dim sSQL AS String
'Assuming Me.ListBox.Column(0) is your Unique ID for your list.

sSQL = "DELETE FROM tblCountry WHERE txtCountry= " & Me.ListBox.Column(0) &
";"
CurrentDb.Execute sSQL
End Sub

Thanks.
ck
 
Top