+ Reply to Thread
Results 1 to 3 of 3

Why "Operation is not allowed when the object is closed" but database connection ok?

  1. #1
    Registered User
    Join Date
    12-14-2011
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    4

    Why "Operation is not allowed when the object is closed" but database connection ok?

    In SPOTRATE sheet there's two macro, actually the same just import different section from database (I'm sure both are existed and active!), however "update 01" macro works all right, but "update 02" doesn't.

    Actually "update 02" successfully connected with database, whereas import nothing, with error msg box "Requeste: exec ps_GET_PNL '20120208','20120209','5J9' Operation is not allowed when the object is closed".

    I attach the excel file here, anyone can help is highly appreciated!!
    Thanks very much!
    Attached Files Attached Files

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Why "Operation is not allowed when the object is closed" but database connection

    Have you stepped through the code to see where the error actually occurs? You don't appear to have any code that checks whether you got any records back before you try and use the recordset.
    Good luck.

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Why "Operation is not allowed when the object is closed" but database connection

    The execute command will return a closed recordset if the query is a non row returning query. What does your stored proc return?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1