Solved

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

Posted on 2012-03-27
8
735 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
 

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now