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/defaul...kb;en-us;275927, but that hasn't worked either.
Any suggestions?? Many thanks.
visual basic code:'change query to select all buildings
'Rs.Close
strsql = "select bldg from bldgtype where type = 1 order by bldg"
Rs.Open strsql, Db
Run-time error: '3705': Operation is not allowed when the object is open.
visual basic code:'change query to select all buildings
Rs.Close
strsql = "select bldg from bldgtype where type = 1 order by bldg"
Rs.Open strsql, Db
Run-time error: '3704': Operation is not allowed when the object is closed.
Re: Runtime error 3705 & 3704 / msdn no help
you could try to completely get rid of it...
rs.close
set rs = nothing
set rs = new adodb.recordset
strsql = "select bldg from bldgtype where type = 1 order by bldg"
Rs.Open strsql, Db
Re: Runtime error 3705 & 3704 / msdn no help
Thank you!!!
VB Code:
Set Rs = Nothing
Set Rs = New ADODB.Recordset
strsql = "select bldg from bldgtype where type = 1 order by bldg"
Rs.Open strsql, Db
Works perfectly!!!
Re: Runtime error 3705 & 3704 / msdn no help
No problemo. Glad to help.
Re: Runtime error 3705 & 3704 / msdn no help
IMHO, it is better to "close" objects properly, rather than abruptly ending the instance by setting it to nothing. If an object has a Close method, call it.
Based on the information it looks like you are calling this procedure multiple times. Just check the state of the rs object and act accordingly.
VB Code:
If rs is Nothing then
Set rs = New ADODB.Recordset
End If
If rs.State = adStateOpen then
rs.Close
End If
strsql = "select bldg from bldgtype where type = 1 order by bldg"
Rs.Open strsql, Db