Solved

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

Posted on 2012-03-27
8
741 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
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…

738 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