Results 1 to 2 of 2

Thread: Runtime error 3705 & 3704 / msdn no help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2005
    Posts
    243

    Runtime error 3705 & 3704 / msdn no help

    I am getting two different runtime errors that I cannot figure out. I origionally didn't have the Rs.close in this code but I put it there hopeing to fix the error. But I have had no luck in trying to figure this out. I also tried the suggestions at MSDN, http://support.microsoft.com/default...b;en-us;275927, but that hasn't worked either.

    Any suggestions?? Many thanks.

    VB Code:
    1. 'change query to select all buildings
    2.         'Rs.Close
    3.         strsql = "select bldg from bldgtype where type = 1 order by bldg"
    4.         Rs.Open strsql, Db


    Run-time error: '3705': Operation is not allowed when the object is open.


    VB Code:
    1. 'change query to select all buildings
    2.         Rs.Close
    3.         strsql = "select bldg from bldgtype where type = 1 order by bldg"
    4.         Rs.Open strsql, Db

    Run-time error: '3704': Operation is not allowed when the object is closed.

  2. #2
    Lively Member
    Join Date
    Nov 2002
    Location
    Cranston, RI
    Posts
    110

    Re: Runtime error 3705 & 3704 / msdn no help

    if you are going to make multiple calls to the db with a similiar query, have you tried to put this code in a function taking in the building type as a parameter, declare the rs locally to the function and pass back the recordset?

    For instance:

    Private Function GetBuildings(byVal bType as integer) as ADODB.Recordset
    dim rs as new ADODB.RecordSet

    rs.open "select bldg from bldgtype where type =" & bType & " order by bldg",db

    return rs
    End Function

    You could also look into using a SqlDataAdapter instead of a recordset.

Posting Permissions

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



Click Here to Expand Forum to Full Width