Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 756
  • Last Modified:

Run time error 3061- Too few parameters, expected 1- VBA ACCESS

Dear Experts,

Can you please help me to solve this issue.
Getting Run time error 3061- Too few parameters, expected 1- VBA ACCESS in the following query,


CurrentDb.Execute "insert into REVIEW_MAIN (Profile_ID,Reviewer_Id,Review_Number,Review_Date,Additional_Review,Final_Review,APPI_Review,FPPI_Review,Punctual_Submission,Presentation,Presentation_Comments) values (ProfileIDR,'" & Me.Combo_Reviewer_RInsert.Value & "','" & Me.Combo_RT_RInsert.Value & "','" & Me.Combo_ReviewInsert.Value & "','" & Me.Check_AR_RInsert.Value & "','" & Me.Check_FR_RInsert.Value & "','" & Me.Check_APPI_RInsert.Value & "','" & Me.Check_FPPI_RInsert.Value & "','" & Me.Check_PS_RInsert.Value & "','" & Me.Combo_Present_RInsert.Value & "','" & Me.Text_PC_RInsert.Value & "')"

Note: Profile_ID,Reviewer_Id,Review_Number- all these field's data type is number
          ProfileIDR is a variable which stores an ID, i used cint(ProfileIDR ) but no changes.

Thanks,
George
0
gtmathewDallas
Asked:
gtmathewDallas
  • 4
  • 4
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
George,

  When your doing SQL on the fly like this, do it this way:

Dim strSQL as string

strSQL = "insert into REVIEW_MAIN (Profile_ID,Reviewer_Id,Review_Number,Review_Date,Additional_Review,Final_Review,APPI_Review,FPPI_Review,Punctual_Submission,Presentation,Presentation_Comments) values (ProfileIDR,'" & Me.Combo_Reviewer_RInsert.Value & "','" & Me.Combo_RT_RInsert.Value & "','" & Me.Combo_ReviewInsert.Value & "','" & Me.Check_AR_RInsert.Value & "','" & Me.Check_FR_RInsert.Value & "','" & Me.Check_APPI_RInsert.Value & "','" & Me.Check_FPPI_RInsert.Value & "','" & Me.Check_PS_RInsert.Value & "','" & Me.Combo_Present_RInsert.Value & "','" & Me.Text_PC_RInsert.Value & "')"

CurrentDB.Execute strSQL, dbFailOnError

Why?  Because you can put a breakpoint or stop before the execute and examine the finial SQL statement (hover over it or use the debug window) before you try to execute it.  Makes it real easy to spot errors such as this.

BTW, you statement looks correct, so I'm guessing you have a mis-spelling somewhere.  Should be very easy to spot when you view the statement.

Jim.
0
 
gtmathewDallasAuthor Commented:
Hi Jim
Thanks you so much for your reply,
the problem is related to the values of check box fields
(Me.Check_AR_RInsert.Value & "','" & Me.Check_FR_RInsert.Value & "','" & Me.Check_APPI_RInsert.Value & "','" & Me.Check_FPPI_RInsert.Value & "','" & Me.Check_PS_RInsert.Value & "')
I can insert the values to the table without above fields, so can you please help me to include those check box vales n the query (its yes/no in the table field)
Thanks
George
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
<<I can insert the values to the table without above fields, so can you please help me to include those check box vales n the query (its yes/no in the table field)>>

 True/False are numeric values so no quotes.

Jim.
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
gtmathewDallasAuthor Commented:
Jim,

Following is the printed SQL,

insert into REVIEW_MAIN (Profile_ID,Reviewer_Id,Review_Number,Review_Date,Additional_Review,Final_Review,APPI_Review,FPPI_Review,Punctual_Submission,Presentation,Presentation_Comments) values ('12','62','7','3/26/2012','-1','-1','-1','','','Accurate','dfcfgsadfa')

If all the check boxes are checked - query will work, but its not- if any unchecked, see the '','', values in query.
Please help me

Thanks,
George
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
George,

 Did you get it working?

 Sorry I missed your last comment (sometimes I go a little too fast in deleting my e-mails).

Jim.
0
 
gtmathewDallasAuthor Commented:
Yes Jim, Its working now (with unchecked check box), but i didnt change any coding :)
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
<<Yes Jim, Its working now (with unchecked check box), but i didnt change any coding :)>>

 Make sure the TripleState property on the check boxes are set to "no"

Triple State allows True (-1), False (0), and NULL

 You don't want null's in there.

Jim.
0
 
gtmathewDallasAuthor Commented:
Yes Jim It is set to 'No'

Thanks,
George
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now