Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    qrydef.execute (2003)

    this used to work -
    Dim qryDef As DAO.QueryDef
    Set qryDef = CurrentDb.QueryDefs("Q0171")
    qryDef.Execute
    but now I am getting error 3061; Too few parameters. expected 1.
    the query works OK on its own
    please show me the error of my ways.

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

    Re: qrydef.execute (2003)

    Does your query have a parameter, either in the form of a prompt that is displayed, or in the form of a reference to a control on a form?
    If so, you must supply the parameter in code, for DAO can't handle it otherwise. For example:

    Set qryDef = CurrentDb.QueryDefs("Q0171")
    qryDef.Parameters("[Enter City]") = InputBox("Enter City")
    qryDef.Execute

    or

    Set qryDef = CurrentDb.QueryDefs("Q0171")
    qryDef.Parameters("[Forms]![frmParam]![txtSomething]") = Forms!frmParam!txtSomething
    qryDef.Execute

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: qrydef.execute (2003)

    That would be it - Thanks Hans

Posting Permissions

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