Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2009
    Posts
    16

    Unanswered: too few parameters Error

    Hi I have a date range query that works fine when run directly but when I try to run it from form it gives me error - too few parameters.

    I know I have parameters in criteria but I don't know how to add it on form button.

    here is the criteria in query
    Between [Forms]![Dupl]![txtStartDate] And [Forms]![Dupl]![txtEndDate]

    here is the code on commad button in form (partly)
    Code:
    Set rs = db.OpenRecordset("SELECT Date, TowerTopic, Items, Media, Audience FROM FilterDate")
    Please help

    Thank you

  2. #2
    Join Date
    Oct 2009
    Posts
    204
    Quote Originally Posted by Alflashy View Post
    Hi I have a date range query that works fine when run directly but when I try to run it from form it gives me error - too few parameters.

    I know I have parameters in criteria but I don't know how to add it on form button.

    here is the criteria in query
    Between [Forms]![Dupl]![txtStartDate] And [Forms]![Dupl]![txtEndDate]

    here is the code on commad button in form (partly)
    Code:
    Set rs = db.OpenRecordset("SELECT Date, TowerTopic, Items, Media, Audience FROM FilterDate")
    Please help

    Thank you
    As long as you have, on form Dupl, txtStartDate and txtEndDate, and there is data in both of those fields, you should be fine. In order for it to work with this criteria, the form must be open with data in the fields. If it still gives you the too few parameters issue, you might have more criteria in another field in the query that it is looking for. That is hard to determine without seeing the WHERE in the SQL.

  3. #3
    Join Date
    Nov 2009
    Posts
    16
    Check out the attached image. It doesn't look like I have any other parameters in the Query. The date is there in the text field and still it say "Too few parameters. Expected 2"

    Any more suggestions please. Stuck here since morning.
    Attached Thumbnails Attached Thumbnails Untitled-1.jpg  

  4. #4
    Join Date
    Oct 2009
    Posts
    204
    Quote Originally Posted by Alflashy View Post
    Check out the attached image. It doesn't look like I have any other parameters in the Query. The date is there in the text field and still it say "Too few parameters. Expected 2"

    Any more suggestions please. Stuck here since morning.
    It is expecting you to put the date in those two fields. It is looking for a form named "Dupl", I am assuming you already have this form created? And on this form it is looking for two text box fields which you use as your criteria. If those two fields are empty, you will get an error. The form needs to be open, and the fields filled in before the query is run.

  5. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You're running into this:

    ACC2000: "Too Few Parameters. Expected 1" Error Message

    You can actually sneak around it by wrapping the form references in the Eval() function.
    Paul

  6. #6
    Join Date
    Nov 2009
    Posts
    16
    yes, I agree with you and that is why I have attached the image in my last post that shows the Dupl form is open and the two date range fields are showing the dates. The filterdate window is showing the date criteria and still having this problem.

    WHAT I AM MISSING????

  7. #7
    Join Date
    Nov 2009
    Posts
    16
    pbaldy, Thank you for helping me again.

    I am newbee so can you give give and example how can I wrap form reference? Actually I am running a query.

  8. #8
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    This type of thing:

    Between Eval('[Forms]![frmTripSheet]![txtFromDate]') And Eval('[Forms]![frmTripSheet]![txtToDate]')
    Paul

  9. #9
    Join Date
    Nov 2009
    Posts
    16
    This is great!!! pbaldy
    Really appreciate your help

    Thank you

  10. #10
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    No problemo!
    Paul

Posting Permissions

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