Error 3061 Expected 2
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss error 3061 too few parameters expected 2 the workings and policies of this site About Us Learn more about
Run Time Error 3061 Too Few Parameters Expected 2
Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions runtime error 3061 expected 1 Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. runtime error 3061 expected 3 Join them; it only takes a minute: Sign up Error 3061 Too few parameters 2 expected up vote 1 down vote favorite I have been facing the error 3061 with error message "Too few Parameters: Expected 2". I have done all of the following to resolve the issue but still couldn't it. I ran the query in SQL
Access Vba Error 3061 Expected 1
mode and it gives me result I checked all the field names I checked all the "&" s are placed. I find them correct. Here is my code: Private Sub cmbYear_Change() Dim db As Database Dim rs As DAO.Recordset Dim Query As String Query = " SELECT Yrs_Teaching, Highest_Edu, AD_Descr FROM ClassSurvey" & _ " WHERE ClassSurvey.Program/School_ID = " & Me.cmbProgId.Value & _ " AND ClassSurvey.ClassID = " & Me.cmbClassId.Value & _ " AND ClassSurvey.Teacher_ID = " & Me.cmbTeacherID.Value & _ " AND ClassSurvey.SYear = " & Me.cmbYear.Value Set db = CurrentDb Set rs = db.OpenRecordset(Query) If rs.RecordCount > 0 Then Me.TB1 = rs!Yrs_Teaching Me.TB2 = rs!Highest_Edu Me.TB3 = rs!AD_Descr Else Me.TB1 = "N/A" End If Set rs = Nothing Set db = Nothing End Sub ms-access access-vba share|improve this question edited Aug 29 '13 at 17:07 HansUp 79.1k114371 asked Aug 29 '13 at 16:33 user1804254 293411 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote It appears your table includes a field named Program/School_ID. Bracket that field
Search Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Page 1 error 3061 in ms access of 2 1 2 > Thread Tools Rating: Display Modes 04-14-2003, 02:19 error 3061 alldata AM #1 Ally Newly Registered User Join Date: Sep 2001 Location: Colchester, Essex, England Posts: 617 Thanks: 0
Run Time Error 3061 Too Few Parameters Expected 1
Thanked 2 Times in 2 Posts Error 3061: Too Few Parameters. Expected 2 I have a form, which is opened from another form. When I try doing anything on the second form, I get http://stackoverflow.com/questions/18516396/error-3061-too-few-parameters-2-expected the error message: Run-time error ‘3061’: Too few parameters. Expected 2 The code that is running is: Code: Private Sub ACPDailyDate_Exit(Cancel As Integer) Dim x, y, z As String Dim r As Recordset, db As Database Dim DocName As String Dim LinkCriteria As String DocName = "frmACPData" Dim intNewRecord As Integer intNewRecord = IsNull(Me.ACPDailyID) Set db = CurrentDb() Set r = db.OpenRecordset("qryPtACPDaily") 'If intNewRecord Then Do Until r.EOF If http://www.access-programmers.co.uk/forums/showthread.php?t=45940 r.Fields("acpdailydate") = Me.ACPDailyDate.Value Then msgbox r.Fields("PtFirstName") & " " & r.Fields ("PtLastName") & " already has ACP data for this date " & _ Chr(13) & r.Fields("acpdailydate"), vbOKOnly + vbExclamation, "Warning" DoCmd.Close Exit Sub ElseIf r.NoMatch Then End If r.MoveNext Loop 'Else Exit Sub 'End If Me.Refresh Exit Sub End Sub The line highlighted is: Set r = db.OpenRecordset("qryPtACPDaily") In the query there are 2 parameters: [Forms]![frmACPData]![EpisodeID] [Forms]![frmACPData]![UnitNo] The query runs fine on its own (when the form’s open). Does anyone know what’s wrong please? __________________ If you want to go to Heaven, you have to go via King's Cross! Not sure what to do with your old photos, or would like a special gift! To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. - UK Last edited by Ally; 04-14-2003 at 02:22 AM. Ally View Public Profile Find More Posts by Ally 04-14-2003, 02:33 AM #2 Mile-O Back once again... Join Date: Dec 2002 Location: Glasgow, UK Posts: 11,312 Thanks: 4 Thanked 112 Times in 107 Posts It would look like you are opening the query (via DAO) when it requires the parameters to
soon) Ruby (coming soon) Getting Started Code Samples Resources Patterns and Practices App Registration Tool Events Podcasts Training API Sandbox Videos Documentation Office Add-ins Office Add-in Availability Office Add-ins https://social.msdn.microsoft.com/Forums/office/en-US/556003a2-f970-4f6e-8bcc-9c8e73e25deb/run-time-error-3061-too-few-parameters-expected-2?forum=accessdev Changelog Microsoft Graph API Office 365 Connectors Office 365 REST APIs SharePoint Add-ins Office UI Fabric Submit to the Office Store All Documentation https://www.yammer.com/ http://feeds.feedburner.com/office/fmNx Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: Run time error 3061. Too few parameters. Expected 2. Microsoft Office for Developers > Access for Developers Question error 3061 0 Sign in to vote It looks valid to me but for some reason I think I will need to change the syntax. Does anyone know what this should look like for Access 2007? Set rs = CurrentDb.OpenRecordset("select distinct report-period from Reports;") Wednesday, November 30, 2011 1:58 AM Reply | Quote Answers 1 Sign in to vote It looks valid to me error 3061 expected but for some reason I think I will need to change the syntax. Does anyone know what this should look like for Access 2007? Set rs = CurrentDb.OpenRecordset("select distinct report-period from Reports;") Is "report-period" the name of a field? If so, the fact that it contains "punctuation" -- in this case, what looks to Access like a minus sign -- means you have to enclose it in square brackets: Set rs = CurrentDb.OpenRecordset("select distinct [report-period] from Reports") Otherwise, Access thinks that "report" and "period" are identifiers, and if they aren't fields in the Reports table then it figures they must be parameters. Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html Marked as answer by S.e.p.y Wednesday, November 30, 2011 2:46 AM Wednesday, November 30, 2011 2:22 AM Reply | Quote Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.Would you like to participate? Privacy statement Community Resources O365 Technical Network MSDN Forums UserVoice Stack Overflow Follow Us Twitter