Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Location
    Seattle
    Posts
    18

    Unanswered: Open Query Problem

    I am using Access 2002.

    I am trying to open a query using OpenRecordSet

    Code is:
    rst = db.OpenRecordSet("qryResident")

    When this code is run, I get an error:
    Run-time error 3061 - Too few parameters. Expected 1.

    qryResident is a query
    In the query window it opens fine

    I also tried DoCmd.OpenQuery (which worked fine)
    When I tried: Set rst1 = DoCmd.OpenQuery, it did NOT work.

    The Access 1997 help says:
    "For the table-type recordset objects in MS jet databases, the source can only be a table name"

    Any idea where the problem is?
    Thanks for any help.
    Meircha

  2. #2
    Join Date
    Aug 2004
    Posts
    7

    Red face Not an answer...

    ..but I have a similar problem. DoCmd.RunQuery works fine, but when I call this command in a macro, the action does not perform. No error messages are received, but the action (append) isn't performed either.

    If anyone has an answer or solution to the problem above, I'd appreciate some assistance with my similar issue.

    Thanks,
    Tiffany

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by meircha
    I am using Access 2002.

    I am trying to open a query using OpenRecordSet

    Code is:
    rst = db.OpenRecordSet("qryResident")

    When this code is run, I get an error:
    Run-time error 3061 - Too few parameters. Expected 1.

    qryResident is a query
    In the query window it opens fine

    I also tried DoCmd.OpenQuery (which worked fine)
    When I tried: Set rst1 = DoCmd.OpenQuery, it did NOT work.

    The Access 1997 help says:
    "For the table-type recordset objects in MS jet databases, the source can only be a table name"

    Any idea where the problem is?
    Thanks for any help.
    Meircha
    And what kind of query is this?
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    Mar 2004
    Location
    Seattle
    Posts
    18
    The query uses one table only.
    It gets some data from a form (which is already open).

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    looks suspiciously DAO-like!

    as an experiment, ALT-F11 then menu:Tools, References ...scroll down to Microsoft DAO 3.6 and check the checkbox

    ...try your code again.

    if that works, you get to decide if you want to use DAO (not referenced by default on A2002) or ADO.

    izy
    currently using SS 2008R2

  6. #6
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    AAAAArrrrgggghhhhhh

    you certainly need
    set rst =

    in DAO or ADO

    izy
    currently using SS 2008R2

Posting Permissions

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