Solved

What could cause being unable to close a Recordset?

Posted on 2001-09-16
3
159 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

729 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