Solved

excel vba - Run-time error '3704': Operation is not allowed when the object is closed

Posted on 2010-08-26
6
1,184 Views
Last Modified: 2012-06-21
I have a macro that works fine, and then we did a MS sql process to add one row of data that we were looking for....that originally wasnt there..

this updated row occured in the MS SQL ..the macro has not changed/nor touched..

Now when the macro is run, I get the above error when trying to run.  The error occurs only on this new row that was just added to the ms sql....
the other data pulling from ms sql is fine.  

I am thinking that when the row/data was added that they either removed the NO SET COUNTS or something occurred when that row was added...or the row is LOCKED...

I am aware that the error has to do with not closing a recordset before accessing it again, but that applies to all the data..not just one row-unless its locked.

I believe the way to resolve this issue is to have the MS SQL side addressed not the excel macro....the row has to be unlocked from the MS SQL side correct?....
0
Comment
Question by:GlobaLevel
  • 4
  • 2
6 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 500 total points
ID: 33532763
does the row need to be committed?

... or, are you not using the (nolock) hint in the query?
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 33532819
Ummmm...can you explain further... I'd have to look...
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 33533158
no there is not a nolock hint in the macro query...not sure how to use that...
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Author Comment

by:GlobaLevel
ID: 33533233
As far as committing...the macro only queries data...nothing permanent here...
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 33535197
any takers?
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 33542248
Sorry, i was out of town yesterday and not able to get back to this one.

I have no idea if this well resolve your issue, but it is easy to try :

   select col1, col2, col3, ...
   from myTable with (nolock)
   where ...
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now