Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012

    Question Unanswered: PLEASE HELP- Run time Error 3061 - Too few paramets.Expected 1.

    I am using Access 2007 for a front end and SQL server 2008 as the backend. I am coding to pull together fields and once done this will be referenced in the creation of a word document from access.

    Here is the SQL I have:

    Dim strSQL As String
    Dim rst As ADODB.Recordset
    Dim cnn As ADODB.Connection

    Set cnn = CurrentProject.Connection
    strSQL = "Select ScopeDate, ScopeVersion, ScopeVersionComments, ScopeCategory, ScopeEDMSLink, ScopeEstimatorName, ScopeProjectPPMCNumber, ScopeProjectName, ScopeNewBusinessClientName, ScopeImpactedParticipants, ScopeImpactedPlans, ScopeProjectDuration, ScopeClientName, ScopeisDeconversion, ScopeOptionNumber, ScopeImpactedProducts, ScopeDescription, NewBusinessQuestion, NewBusinessStandard, NewBusinessClientInput, NewBusinessHoursChange, NewBusinessDifference, NewBusinessQuestionfinalhours, NewBusinessQuestionNotes, DeconversionPopulationSize, DeconversionStandard, DeconversionRetireeAdmin, DeconversionNotes, DeconversionHours, ScopeTaskProjectPPMCID, ScopeTaskPrimaryTaskName, ScopeTaskSecondaryTaskName, ScopeTaskComplexity, ScopeTaskAssumptions, ScopeTaskOptionNumber, numsecondarytasks, TaskHours, TaskFinalHours FROM dbo_SCOPE, dbo_NewBusinessScope, dbo_SCOPETask, dbo_DeconversionScope Where [ScopeProjectPPMCNumber] = [Forms]![NewScope]![ScopeProjectPPMCNumber]"

    Set rst = CurrentDb.OpenRecordset(strSQL)

  2. #2
    Join Date
    Apr 2004
    Derbyshire, UK
    Provided Answers: 1

    I think the following 3 think need changing

    First on the basis that the reference form is currently open then the WHERE clause need changing from this

     ... Where [ScopeProjectPPMCNumber] = [Forms]![NewScope]![ScopeProjectPPMCNumber]"
    to this
     ... Where [ScopeProjectPPMCNumber] = " & Form_NewScope.ScopeProjectPPMCNumber
    or this
     ... Where [ScopeProjectPPMCNumber] = " & Forms("NewScope").Controls("ScopeProjectPPMCNumber")
    You cannot reference object properties using string literals (ie pasting query strings from query designer), you have to reference the object properties (values) directy and concatinate then into the string.

    Second you have declare an ADO recordset, so it need instantiating ie
    Set rst = New ADODB.Recordset
    needs adding before it is opened.

    And finally opening a DAO recordset uses different syntax to a DAO recordset ie

    rst.Open strSQL, cnn
    Appart from that it seem fine!?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts