• error 3001 – open recordset (vba/Access 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » error 3001 – open recordset (vba/Access 2003)

    Author
    Topic
    #437749

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #1041664

      Try

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

      Additional question: is buid actually a text field?

      • #1041686

        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.

    Viewing 0 reply threads
    Reply To: error 3001 – open recordset (vba/Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: