Runtime Error 3061 Too Few Parameters Expected 3 (1 Viewer)

patelr26

New member
Local time
Yesterday, 18:20
Joined
Jul 14, 2008
Messages
5
Hi,

I am trying to update table from form but I am getting an [Runtime Error 3061 Too few parameters Expected 3]. Below is the code.
Any assistance would be highly appreciated

Table Details:
Table name is FormData
Table Fields are Co Code, Stage and Sub Stage (Datatype for all fields - Text)

Form Details:
Text Box1 “Stage”
Text Box2 “SubStage”
Text Box3 “CoCode”
Button “Command48


Private Sub Command48_Click()

Dim strSQL As String

Debug.Print
strSQL = "UPDATE FormData SET " & _
" [FormData].[Stage] = " & Me.Stage & "," & _
" [FormData].[Sub Stage] = " & Me.SubStage & _
" WHERE [FormData].[Co Code] = " & Me.CoCode & ";"

CurrentDb.Execute strSQL

End Sub


 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:20
Joined
Aug 30, 2003
Messages
36,118
Generally, text values must be surrounded by single quotes, like:

" [FormData].[Stage] = '" & Me.Stage & "'," & _
 

patelr26

New member
Local time
Yesterday, 18:20
Joined
Jul 14, 2008
Messages
5
Hi Paul,

Thank you for your help. I updated the code as advised, i am still getting the runtime error 3144 and the red color statement below is highlighted in yellow. Could i please request you to refer the updated code below and advise


Private Sub Command48_Click()
Dim strSQL As String
Debug.Print
strSQL = "UPDATE FormData SET " & _
" [FormData].[Stage] = '" & Me.Stage & "'," & _
" [FormData].[Sub Stage] = '" & Me.SubStage & "', " & _
" WHERE [FormData].[Co Code] = '" & Me.CoCode & ";"

CurrentDb.Execute strSQL

End Sub
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:20
Joined
Aug 30, 2003
Messages
36,118
In the interests of teaching you how to fish, add

Debug.Print strSQL

before the execute line and examine the finished string in the immediate window. I think you'll spot the problem.
 

Users who are viewing this thread

Top Bottom