Results 1 to 12 of 12
  1. #1
    Join Date
    Jan 2004
    Location
    Oakland, Ca
    Posts
    6

    Red face Unanswered: openRecordset Method (I am in need of some aid)

    I have a moduele witha statement that look like this:


    Set rs = db.OpenRecordset("qryMemberByState")

    When the code runns I get he error:

    Run-time error '3061':
    Too fer parameters. Expected 1.

    I am guessing because the query has parametes.
    The query has parameters that get values from a textbox in a form. Any ideas on how I can get around this?

    Ken

  2. #2
    Join Date
    Sep 2003
    Posts
    29

    Re: openRecordset Method (I am in need of some aid)

    Takea look at the SQL of the query in question. I have run in to this occasionally and have found that the Syntax of the SQL is usually missing something or that the fields you are looking for do not exist.


    Originally posted by Kenworx
    I have a moduele witha statement that look like this:


    Set rs = db.OpenRecordset("qryMemberByState")

    When the code runns I get he error:

    Run-time error '3061':
    Too fer parameters. Expected 1.

    I am guessing because the query has parametes.
    The query has parameters that get values from a textbox in a form. Any ideas on how I can get around this?

    Ken

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Try to write your sql in the Statement
    Set rs = db.OpenRecordset("SELECT * FROM yourTable", dbOpenDynaset)

  4. #4
    Join Date
    Jan 2004
    Location
    Oakland, Ca
    Posts
    6

    Re: openRecordset Method (I am in need of some aid)

    Originally posted by abboabbo
    Takea look at the SQL of the query in question. I have run in to this occasionally and have found that the Syntax of the SQL is usually missing something or that the fields you are looking for do not exist.
    I have messed with the query and still not luck.
    The syntax of the query in sql view is as followes"

    SELECT tblMember.MemberID, tblMember.FName, tblMember.LName, tblMember.Address1, tblMember.Address2, tblMember.ZIP, tblMember.City, tblMember.Email, tblMember.State, tblMember.Journal
    FROM tblMember
    WHERE (((tblMember.State)=[forms]![MailTo]![txtState]))
    ORDER BY tblMember.State;

    Any ideas !!??!

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Is the form that the query has a dependency on open?

  6. #6
    Join Date
    Jan 2004
    Location
    Oakland, Ca
    Posts
    6
    Originally posted by M Owen
    Is the form that the query has a dependency on open?

    It seem that I am going to have to accept the fact that I am not as smart as I am buuut....
    I am not quite following you?

  7. #7
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by Kenworx
    It seem that I am going to have to accept the fact that I am not as smart as I am buuut....
    I am not quite following you?
    What is there not to follow? Is the form that the query gets it parameter from open at the time you run the query?

  8. #8
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    is the form which holds the citeria open (jargon: "in scope") ?

    izy
    currently using SS 2008R2

  9. #9
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    touché M Owen ...izy
    currently using SS 2008R2

  10. #10
    Join Date
    Jan 2004
    Location
    Oakland, Ca
    Posts
    6
    Yes it is,

    The form has a command button that sends a call to a modlule tha has that code snippet and the text box is on that form and has data in it.

  11. #11
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by Kenworx
    Yes it is,

    The form has a command button that sends a call to a modlule tha has that code snippet and the text box is on that form and has data in it.
    Now, can I assume that you can run the query directly and it works?

  12. #12
    Join Date
    Jan 2004
    Location
    Oakland, Ca
    Posts
    6
    Felks,

    Yep the query works fine, If I were to Dbl-click it on the database window (With the form open) and it works fine. As soon as I try to run this module I get this problem.

Posting Permissions

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