Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Nov 2001
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    RecordSet Error (A2000)

    I'm stumped by this one.

    My form has several events that loop through recordsets for various reasons. All of the events work fine with one exception. I can't see any difference in the code. I'm getting an error while defining a recordset. The code (up to the point of the error) is as follows:

    Dim dbs As Database
    Dim rst As Recordset
    Dim strSource As String

    strSource = "qryData"

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset (strSource)

    When I try to execute the code I get the following error: "Run Time Error '3061': Too few parameters. Expected 1." Apparently, this is not a trappable error since I don't get an error indication when compiling. The query opens fine and shows the expected records.

    Any thoughts? I've tried DIM dbs as DAO.Database, etc. without any change.

  2. #2
    Lounger
    Join Date
    Feb 2001
    Location
    TX, USA
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RecordSet Error (A2000)

    post the query string. that is where your error seems to be

  3. #3
    New Lounger
    Join Date
    Nov 2001
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RecordSet Error (A2000)

    That apparently was the problem. It didn't matter if I referenced a query or an SQL statement. The desired record set was a query that referenced a cross-tab query. I modified the query to create a temporary table with the data and used the table as the RecordSet. Everything is now working. Thanks for the direction.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: RecordSet Error (A2000)

    Crosstab queries can cause all sorts of trouble when you try to use them like that. One problem can often be solved by creating column headings for the crosstab. That seems to stabilize it.
    Charlotte

  5. #5
    New Lounger
    Join Date
    Nov 2001
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RecordSet Error (A2000)

    Unfortunately, I was using column headings and it still caused problems. It appears that my work around (make table then use the table as rst) will function although I hate cluttering up my database with extra queries and tables.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: RecordSet Error (A2000)

    Was there a parameter in the crosstab query or in a query underlying it? That's another place where you get bitten with crosstabs. Any underlying parameters need to be specifically created as parameters, not just put into the critiera line.
    Charlotte

  7. #7
    New Lounger
    Join Date
    Nov 2001
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RecordSet Error (A2000)

    The parameter was referencing a field on an open form. I hadn't thought about creating a parameter for it - whenever I set the criteria either from a form field or if the querydef was set using code I've not created a parameter - but then I haven't had to use a lot of cross-tabs either.

Posting Permissions

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