Solved

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

Posted on 2012-03-27
8
738 Views
Last Modified: 2012-06-27
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
Comment
Question by:gtmathewDallas
  • 4
  • 4
8 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 37773710
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
 

Author Comment

by:gtmathewDallas
ID: 37773954
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
 
LVL 57
ID: 37773974
<<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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:gtmathewDallas
ID: 37774092
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
 
LVL 57
ID: 37778160
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
 

Author Comment

by:gtmathewDallas
ID: 37778194
Yes Jim, Its working now (with unchecked check box), but i didnt change any coding :)
0
 
LVL 57
ID: 37778219
<<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
 

Author Comment

by:gtmathewDallas
ID: 37778357
Yes Jim It is set to 'No'

Thanks,
George
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question