Solved

What could cause being unable to close a Recordset?

Posted on 2001-09-16
3
154 Views
Last Modified: 2008-03-17
    My application is MDI. I have a child form which opens a recordset on a table, keeps it open as long as the form is up, and then when the form is about to be unloaded, attempts to close the recordset.
     For some reason, in some circumstances I repeatedly get Error #3219, "Operation is not allowed in this context."
     I have two other recordsets which are also opened initially and closed at unload time, and they give me no trouble.
     I've tried a bunch of things, and have wasted over a day banging my head against this stone wall. It would sure help if someone could suggest one or more things which might cause this problem.
     Has anyone come across this particular problem before? If so, I'd appreciate your input.
0
Comment
Question by:GebhartBob
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 50 total points
ID: 6486023
Hi GebhartBob,  maybe the close of teh recordset wouldn't process because VB saw that there were changes made to the recordset, and didn't want to close it until those changes were either applied or canceled

So maybe adding a .CancelUpdate before the .Close, will solve it. If this is the case then add a dialog box to warn the user that he's about to discard changes made to the record

HTH:O)Bruintje
0
 

Author Comment

by:GebhartBob
ID: 6486093
    That's absolutely brilliant, bruintje! I just stuck in the rst.CancelUpdate before the rst.Close, and it closed very nicely!
     Now, of course, my problem is to figure out why I didn't issue a rst.Update command. I should have, but must not have.
     But now ... at last ... I have something solid to fight.
     Many, many thanks for the helping hand. You've made my life a good deal easier.
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6486106
you're welcome :O)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

747 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

11 Experts available now in Live!

Get 1:1 Help Now