Results 1 to 2 of 2
  1. #1
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Too few parameters (Access 2003 SP2)

    I have code that references a query, that query has 2 parameters. when i run my code to build an sql to run i get the "too few parameters"
    the code is:
    <pre> For Each qdf In dbs.QueryDefs
    ' loop thru the queries qry EOM A001 xxxx thru qry EOM A036 xxxx
    If Left(qdf.Name, 6) = "qry A0" Then
    If qdf.Name < "qry A041" Then
    qdf.Parameters("[forms]![frm EOM]![asatDate]") = [Forms]![frm EOM]![AsAtDate]
    qdf.Parameters("[forms]![frm EOM]![Company]") = [Forms]![frm EOM]![Company]
    sSql = "SELECT q.Server, q.Description, q.Amt, l.FieldNumber"
    sSql = sSql & " FROM [" & qdf.Name & "] AS q"
    sSql = sSql & " INNER JOIN [tbl EOM A LookupVal] AS l"
    sSql = sSql & " ON (q.LookupVal=l.LookupVal) AND (q.QryNo=l.QryNo);"
    Set qdf = dbs.QueryDefs("qry A work")
    qdf.SQL = sSql
    Set rs = qdf.OpenRecordset()
    </pre>


    What am i doing wrong?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Too few parameters (Access 2003 SP2)

    Im sorry about that, i had the parameters commands, they should be after the qdf.sql = ssql line

Posting Permissions

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