Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Apr 2002
    Location
    Bloomsburg, Pennsylvania
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    error 3001 - open recordset (vba/Access 2003)

    I'm getting this error, 3001, "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another." when I try to open a 2nd recordset, using a field from the outer loop, in the first recordset.

    I display the sql statement used in the open with debug, and the syntax looks correct. I also took this display and tried running it as a query, and it works fine. I'm not sure what else to check. I have the database set to use ANSI 92 syntax.

    rst is the outer loop. I'm getting the students id's from that loop.
    rst2 is the inner loop. For each id I have to select all the rows that apply, then I'm building an email with CDO. I get the error on the rst2.open

    ...
    rst.MoveFirst
    Do Until rst.EOF
    sql2 = "SELECT FerpaStu.lname, FerpaStu.fname, FerpaStu.mi, Fin219.buid, Fin219.ID, " & _
    "FerpaStu.email, Fin219.award_type, Fin219.award_amt, Fin219.applied_to_balance, " & _
    "Fin219.check_amt, Fin219.asterik " & _
    "FROM Fin219 INNER JOIN FerpaStu ON Fin219.buid = FerpaStu.buid " & _
    "WHERE (([Fin219].[buid]= '" & rst!buid & "'))" & _
    "ORDER BY FerpaStu.lname, FerpaStu.fname, FerpaStu.mi, Fin219.buid, Fin219.ID;"

    Debug.Print "sql2: "; sql2

    rst2.Open sql2, adOpenStatic, adLockOptimistic

    The debug looks like this:
    sql2: SELECT FerpaStu.lname, FerpaStu.fname, FerpaStu.mi, Fin219.buid, Fin219.ID, FerpaStu.email, Fin219.award_type, Fin219.award_amt, Fin219.applied_to_balance, Fin219.check_amt, Fin219.asterik FROM Fin219 INNER JOIN FerpaStu ON Fin219.buid = FerpaStu.buid WHERE (([Fin219].[buid]= '120192'))ORDER BY FerpaStu.lname, FerpaStu.fname, FerpaStu.mi, Fin219.buid, Fin219.ID;

    120192 is the right id, the first one selected in the outer loop.
    I didn't put anything for the Activeconnection parameter on the open because it said it's optional. If I put an additional comma in the open, where the activeconnection parameter would be, then I get an error that the open is incorrect.

    Let me know if you need any additional information. I hope someone has seen this before. Thanks in advance.

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

    Re: error 3001 - open recordset (vba/Access 2003)

    Try

    rst2.Open sql2, CurrentProject.Connection, adOpenStatic, adLockOptimistic

    Additional question: is buid actually a text field?

  3. #3
    Lounger
    Join Date
    Apr 2002
    Location
    Bloomsburg, Pennsylvania
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: error 3001 - open recordset (vba/Access 2003)

    Thank you very much. That worked. I SWEAR I tried that, but I must have changed something else in the meantime. Thanks so much for your quick response.

Posting Permissions

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