+ Reply to Thread
Results 1 to 3 of 3

Thread: 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
    Valued Forum Contributor 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,647

    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
    Valued Forum Contributor Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds/Sheffield, England
    MS-Off Ver
    Excel 2003
    Posts
    1,031

    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?
    Click the * below to say thanks

    Girls sleep with guys who use photoshop, but marry the ones who work with Excel

    Corduroy
    pillows: They're making headlines!

    Did you mean: recursion
    http://www.google.com/search?hl=en&q=recursion

+ 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.2.0