PDA

View Full Version : Operation is not allowed when the object is open.


ngaisteve1
01-07-2004, 03:47 AM
When I tried to take out the comment line got this problem,

Error mesg: Operation is not allowed when the object is open.

Code in attachment

Don't bother about rs and conn for I got include file for that.

Thanks.:)

bassrek
01-07-2004, 07:16 AM
With the code commented as you have it now, it works because you only attempt to open the rs connection once. When you take the comments out, it goes into the loop. The first time through the loop, it will open the rs connection and leave it open. Then the second time, it will attempt to open it again, but it's already open, so that is the error message it's giving you.

I'm assuming you're planning on doing something with the data you get from your rs connection, so after you're done with the connection, issue at least a rs.close statement before your rs_product_cat.movenext statement. When you're done with rs all together, be sure to issue a set rs = nothing statement as well.

ngaisteve1
01-07-2004, 07:45 PM
Thanks, bassrek. It works. But, the problem now is I can only see one product category only. It should be a product category, a list of companies inside it, then another product category, another list of companies inside it. Now is one product category, then all the list of companies.

Dr. Web
01-07-2004, 08:36 PM
what I usually do in this situation is listed below, in psuedo code. Assuming that you have, a one to many relationship between two entities... one movie, many actors.



run query to get all movies

loop query of movies
...query to get all actors in this specific movie
...display movie title
......loop to display all actors in this movie
......end actor loop
end movie loop


as bassrek noted earlier, you need to pay close attention to your query (and close() ) statements fall. The above psuedo code should get you to where you want to be.

ngaisteve1
01-09-2004, 08:04 PM
Alright, I got it actually, just couldn't see, 'hidden' under one of the records coz didn't have line spacing. I only found it using Ctrl + F. Thanks.