Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2003
    Posts
    123

    Angry Unanswered: Too Few Parameters, whyyyyyyyyyyyy?

    All right, I really hate this error message. I have "too few parameters" despite taking the SQL directly from the Query Builder (plus adding the variable FindTick):

    FindTick = "AL"

    SELECT FOX_SMF.* FROM FOX_SMF WHERE (((FOX_SMF.C_ISS_GRP) = 'FT') And ((FOX_SMF.I_TICKER) Like '" & FindTick & "*') And ((FOX_SMF.D_EXP_DT) > Date)) ORDER BY FOX_SMF.I_ASSET_ID;

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Just for the heck of it try...

    SELECT * FROM FOX_SMF WHERE (((FOX_SMF.C_ISS_GRP) = 'FT') And ((FOX_SMF.I_TICKER) Like '" & FindTick & "*') And ((FOX_SMF.D_EXP_DT) > Date)) ORDER BY FOX_SMF.I_ASSET_ID;

  3. #3
    Join Date
    Aug 2003
    Posts
    123
    Nope, still getting "Too few parameters. Expected 1."

  4. #4
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    Okay what is this SQL statement trying to do? Is this running from a 'search' form that you have created? Are you trying to let a user type in a value click a button and it return records with that value?

    Hope I can help,
    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  5. #5
    Join Date
    May 2004
    Location
    Toronto
    Posts
    7

    Date Variable

    Try this for the date variable - #" & Date & "#, unsure if that is a string. Also try isolating the problem by removing all your criteria in the WHERE clause and then add them back in one by one, at least you can see where the problem occurs.

    Hopes that gives a lead...

    Mark

  6. #6
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    The problem is probably is with the date: VB will convert the date to a string, but SQL will not convert the string back to a date unless you use the #'s.

    As a debugging tip, use a string to hold the SQL statement, that way you can "watch" the string to make sure the statement is actually formatting correctly.
    Code:
    strSQL = "SELECT FOX_SMF.* FROM FOX_SMF WHERE (((FOX_SMF.C_ISS_GRP) = 'FT') And ((FOX_SMF.I_TICKER) Like '" & FindTick & "*') And ((FOX_SMF.D_EXP_DT) > #" & Date & "#)) ORDER BY FOX_SMF.I_ASSET_ID;"
    
    MsgBox strSQL
    To insulate yourself from varying default date formats from PC to PC, use this in place of Date:
    Code:
    Format(Now(),"mm/dd/yyyy")
    This will allow you to determine if the problem is with getting the correct information into the SQL statement or if the problem is with the execution of the SQL statement.

    Good luck

  7. #7
    Join Date
    Aug 2003
    Posts
    123
    Yeah, it was the Date thing. Thanks!

Posting Permissions

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