Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Parameter query (2003 sp3)

    I do not understand why a simple parameter query runs without error when I use docmd.OpenQuery, but gives the error "Too few parameters. Expecting 2. when I use db.execute? The parameters are passed to the query via an open form.
    Thanks
    chuck

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

    Re: Parameter query (2003 sp3)

    DoCmd.OpenQuery is an Access method, it's the code equivalent of opening a query from the database window.
    (Current)Db.Execute is a DAO method. DAO operates at a lower level than the Access interface, it can't handle parameter prompts and references to controls on a form. There are ways around this, but if you want to keep the parameter prompt, it's probably easiest to stick with DoCmd.OpenQuery.

Posting Permissions

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