Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Too few parameters (Access 2003)

    Can someone tell me why I get the message, too few parameters, expected 1,?

    strSQL = "SELECT AthleteNames.Athlete, AthleteNames.AthleteID, AthleteNames.Country"
    strSQL = strSQL & " FROM AthleteNames"
    strSQL = strSQL & " WHERE ((AthleteNames.AthleteID)=[FORMS]![Mainform1]![Subform1].[form].[AthletesList].[Column(0)]);"

    Set DB = CurrentDb()
    Set rsAthleteNames = DB.OpenRecordset(strSQL)

    I have tried all I can, it works okay in the querygrid but after converting throws error. Thanks

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Too few parameters (Access 2003)

    Try change the last line:

    From this: strSQL = strSQL & " WHERE ((AthleteNames.AthleteID)=[FORMS]![Mainform1]![Subform1].[form].[AthletesList].[Column(0)]);"

    To this: strSQL = strSQL & " WHERE AthleteNames.AthleteID=" & [FORMS]![Mainform1]![Subform1].[form].AthletesList.Column(0)
    (assuming AthleteID is numeric)

    BTW, if Column(0) is the bound column for AthleteList, then you don't need to specify it in the SQL.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Too few parameters (Access 2003)

    Many thanks Mark, that fixed it. Have a good weekend, and thanks again.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Too few parameters (Access 2003)

    Mark has already provided the solution. The explanation is that DAO operates at a lower level than the Access interface. It doesn't "know" about Access forms, so the reference to a control on a form causes the "too few parameters" error message. This is what I alluded to in my reply <post:=704,076>post 704,076</post:> in a previous thread. The workaround is to concatenate with the value of the control, so that the resulting SQL string doesn't contain a reference to a control any more.

  5. #5
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Too few parameters (Access 2003)

    Thanks Hans. I got the syntax from the Utter Access download. Think I will try and understand the rules and not go for an easy fix. Thanks again, regards

Posting Permissions

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