Results 1 to 8 of 8
  1. #1
    haishuoBB is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2013
    Posts
    4

    Error on too few parameters expected 3

    Hi, I am VBA newbie and I can't figure out what is wrong with my code, it give me the "too few parameters expected 3" error all the time...


    Here is my stupid code...
    Code:
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim result As DAO.Recordset
    
    Dim str1 As String
    Dim str2 As String
    
    Set db = CurrentDb
    str1 = "SELECT * FROM Query1;"
    str2 = "SELECT * FROM Query2;"
    Set rst = db.OpenRecordset(str1, dbOpenSnapshot)
    Set result = db.OpenRecordset(str2, dbOpenDynaset)

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Presumably your queries have form parameters in them:

    Too Few Parameters. Expected 1 Error Message

    You can try the Eval() function in the query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    haishuoBB is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2013
    Posts
    4
    Thanks for the advice, can you tell me more like how to use the Eval() function? Where to fit it?
    Quote Originally Posted by pbaldy View Post
    Presumably your queries have form parameters in them:

    Too Few Parameters. Expected 1 Error Message

    You can try the Eval() function in the query.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Around a form reference:

    Eval('Forms!FormName.ControlName')
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    haishuoBB is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2013
    Posts
    4
    It still not work...and my query is not in the form, it is a intermedia query...How can I deal with that?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sorry, I'm not familiar with intermedia queries.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    haishuoBB is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2013
    Posts
    4
    no worries...it is not the query which I used to build my form with a control, I use these two queries as a intermedia things to select some data and then I will use this two query to build the my final query which will be introduce to the combo box in my form, so I don't know how to use the 'Forms!FormName.ControlName' things in my code here

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Too Few Parameters. Expected 1
    By flamesofdoom in forum Programming
    Replies: 1
    Last Post: 02-15-2013, 02:23 PM
  2. Replies: 1
    Last Post: 01-29-2013, 10:24 AM
  3. 3061 Error. Too few parameters. Expected 1.
    By rghollenbeck in forum Queries
    Replies: 5
    Last Post: 09-28-2011, 12:12 PM
  4. Replies: 1
    Last Post: 05-21-2011, 01:33 AM
  5. Too few parameters expected 4
    By forestgump in forum Programming
    Replies: 1
    Last Post: 04-15-2011, 09:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums