Error 3061 to few parameters 1

Joined
Dec 4, 2009
Messages
1
Reaction score
0
Not really sure where to post this question but hope it gets to the right place, viewers.
I have tried posting this question in other places on the web but with no success just hoping that someone can help me here!!
I have a program that uses a access database with a table that saves images, i have the program working ok saving the images and populating a listbox with the image names. What i am trying to do is delete records from the database by clicking a command button (delete) but i seem to have some sort of problem with my SQL statement where it gives me the error 3061 to few parameters 1, so can somebody please tell me what i am doing wrong. The codeis as follows:-
Here i add the images to te database

Private Sub Command1_Click()
On Error GoTo Command1_Click_Err 'Error Code Inserted: 11/8/2009 5:38:50 PM ----------ERR--

Const sMOD_NAME As String = "frmContEntryNew.cmdAddImage_Click"
''On Error GoTo Error_Handler
Dim mypicture As String
Dim FN As String
Dim filebinary As String
Dim imagename As String
imagename = Text1(0)
With Dlgs
.Filter = "(*.bmp;*.jpg;*.gif;*.dat;*.pcx)| *.bmp;*.jpg;*.gif;*.dat;*.pcx|(*.psd)|*.psd|(*.All files)|*.*"
.ShowOpen

If .fileName = "" Then Exit Sub
mypicture = .fileName
FN = .FileTitle
'Open File And Read as Binary
Open .fileName For Binary Access Read As #1
filebinary = Space(LOF(1))
Get #1, , filebinary
Close #1
Image2.Picture = LoadPicture(.fileName)
'Add File To DB
' code to add the image to the database and refill the listbox

With rspic
.AddNew
!Client = imagename
!Img_name = FN
!Image = filebinary
.Update
End With
Call GetAllFiles
End With
Exit Sub
Command1_Click_Err: 'Error Code Inserted: 11/8/2009 5:38:50 PM ----------ERR--
If Err <> 0 Then
TestProc_Err: 'Error Code Inserted: 2/4/98 9:12:54 p ----------ERR--
If Err <> 0 Then
frmError.ErrMsg "contact entry", "mTestEnd", Erl, Err
End If
End If
End Sub

And here is where i have the problem when i try to delete a record

Private Sub Command2_Click() 'Listbox clicked
Dim listboxstring As String
Dim SQL As String
listboxstring = List1.Text
'Code to delete item from database and listbox
'***************************************************
SQL = "DELETE * FROM pic WHERE Img_name = " & listboxstring
dbContact.Execute (SQL)
'***************************************************
List1.Selected(List1.ListCount - 1) = True
Call GetAllFiles
End Sub


Will somebody please helpme resolve this error
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top