• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

Operation

what does it mean operation not aloud in this context.

I have closed all of my recordsets etc and set them to nothing.What else does this mean?
0
thenone
Asked:
thenone
  • 6
  • 4
  • 3
  • +1
1 Solution
 
EDDYKTCommented:
If you search "operation not allow in this context" on EE, you will get a lot of returns talking about this. We need to get more info in order to determine

8->
0
 
Leo EikelmanDirector, IT and Business DevelopmentCommented:
say you have a record set called rsSubMain, then try this

If rsSubMain.State = 1 Then
    rsSubMain.Close
    rsSubMain = Nothing
End If

Leo
0
 
thenoneAuthor Commented:
ok I have already done this and it still happens.The weird thing is it doesn't happen all of the time.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
Leo EikelmanDirector, IT and Business DevelopmentCommented:
post your code please

Leo
0
 
daniel_j_cCommented:
if you want to be really safe, you could do something like this (assuming the problem is occuring at cleanup)

if not rsSubMain is nothing then
  if rsSubMain.State <> adStateClosed then rsSubMain.close
  set rsSubMain = nothing
end if
0
 
thenoneAuthor Commented:
I can't post all of my code because I have alot of active x components and it wouldn't make since but I will give you the breakdown scenario.

I have

on error goto errorhandler:
conn.open
rs.open

some events

and then

rs.close
conn.close
set rs = nothing
set conn = nothing

errorhandler:
rs.delete
rs.movenext
rs.close
conn.close
set rs=nothing
set conn=nothing
0
 
EDDYKTCommented:
how do you open your recordset? client or server side cursor? etc
0
 
thenoneAuthor Commented:
client not server
0
 
EDDYKTCommented:
if it is client side, then as long as you do not update to server

then remove these lines

rs.delete
rs.movenext
0
 
thenoneAuthor Commented:
The thing is I update to the server if there is an error I have to move to the next record.Its just the weirdest thing if that was the case then I would get the error all of the time.
0
 
Leo EikelmanDirector, IT and Business DevelopmentCommented:
So I am assuming you are using something like this

if not rsSubMain is nothing then
  if rsSubMain.State <> adStateClosed then rsSubMain.close
  set rsSubMain = nothing
end if


it's just not posted in the code right?  I also assume you are checking if NOT rs.EOF before the delete and movenext.


Also, it is generally not a good idea to DELETE with a recordset.  You should use the connection object and use an SQL delete statement, such as

objConnection.Execute "Delete FROM ComboData where SOME CONDITIONS"



Leo
0
 
thenoneAuthor Commented:
so you are saying add this to every asspect of closing the record in my function

if not rs is nothing then
  if rs.State <> adStateClosed then rs.close
  set rs = nothing
end if
0
 
Leo EikelmanDirector, IT and Business DevelopmentCommented:
yes.

Also, set this property for yoru connection before opening it.

conn.CursorLocation = adUseClient


Leo
0
 
thenoneAuthor Commented:
Thanks leo I will give that a try.It just puzzles me that it doesn't happen all of the time.
Also could you help me with this question if you do not mind.I will post points tonight.

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21819238.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 6
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now