Results 1 to 3 of 3
  1. #1
    Join Date
    May 2014

    Unanswered: SQL in VBA Problem

    I have the following coded:

    Dim dbCurr As DAO.Database
    Dim rs As DAO.Recordset
    Dim SQL As String
    Dim criteria As String

    criteria = "[keyx] = '" + gblKey + "'"

    SQL = "SELECT buyer, customer " & _
    "FROM [dbo_Part Shortages] Where " & criteria & " "
    Debug.Print SQL
    Set dbCurr = CurrentDb
    Set rs = dbCurr.OpenRecordset(SQL)

    I am getting an error when it run: Runtime error 3061-Too few parameters expected 1.

    If I get to work, where can I get the buyer and customer from? This is new to me. Any help is appreciated.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    to parameters indicates that a function methid has been caled with the wrong number of parameters (effectively a required paramter has been omitted).

    that could be cause by omission, youv'e no supplied the required parameters
    it could be that your data includes characters that could no be interrested by Access and its thrown its hands up in horror and sulks

    as to which is which its hard to tell as we dont' know which function or method is reporting the error

    nor do we know the the SQL you are trying to actually run
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    You can also get that error if Access doesn't recognize the table or field names, so double check the spellings of those. This may help:


    specifically the part about copying the SQL to a blank query and running it.

Tags for this Thread

Posting Permissions

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