Results 1 to 7 of 7

Thread: Op not allowed when obj is closed? - RESOLVED

  1. #1

    Thread Starter
    Lively Member mdsoren's Avatar
    Join Date
    Apr 2002
    Location
    Iowa, USA
    Posts
    113

    Op not allowed when obj is closed? - RESOLVED

    I get the following error when attempting to assign a recordset as the Data source for a DataReport in VB6...

    "Operation not allowed when object is closed."

    I have not explicitly closed the newly created rst.
    I am using:
    cursorlocation of adUseClient
    cursortype of adLockReadOnly
    cursorlocktype of adLockOptimistic

    What else can i check? The very next step after creating the rst I check the recordcount and that is when I am getting the error.

    HELP!
    Last edited by mdsoren; Sep 20th, 2002 at 12:42 PM.

  2. #2
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Re: Op not allowed when obj is closed?

    Originally posted by mdsoren
    I get the following error when attempting to assign a recordset as the Data source for a DataReport in VB6...

    "Operation not allowed when object is closed."

    I have not explicitly closed the newly created rst.
    I am using:
    cursorlocation of adUseClient
    cursortype of adLockReadOnly
    cursorlocktype of adLockOptimistic

    What else can i check? The very next step after creating the rst I check the recordcount and that is when I am getting the error.

    HELP!
    There must be a problem with the query. So, you don't get any recordset.... this means the rst is closed.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Wow. Not much info to go off of. Here's what I got:
    1) Make sure that there wasn't an error when getting the recordset. The Connection obj has an Errors collection you can check.
    2) Make sure the connection wasn't closed (either on purpose or accidently).
    3) Try posting the actual code. Sometimes the answer isn't obvious until some one else has looked at it too.

    See if #1 or 2 help, if not, try #3.

    PS: Go Clones!
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Lively Member mdsoren's Avatar
    Join Date
    Apr 2002
    Location
    Iowa, USA
    Posts
    113
    If I run the query in the data enviromnment designer and give the same input as I do in the app, I get the expected rst.... hmmmm?

    I will continue to muddle away and get back to this if still unresolved later today.

    Thanx ALL!
    MDS

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    DEBUG!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    put a break point on the sub routine that gets the error... then step through each line to find out where it is erroring...

    people don't use the debugger as much as they should... it saves a ton of headaches and time

  6. #6

    Thread Starter
    Lively Member mdsoren's Avatar
    Join Date
    Apr 2002
    Location
    Iowa, USA
    Posts
    113
    There was an error in the command text in my inner join - DUH!

    Not sure why it worked in the dataenvironment and not in code, but then at this point it doesn't matter and i don't care!

  7. #7
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Thumbs up

    Cheers!!
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

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