Solved

What could cause being unable to close a Recordset?

Posted on 2001-09-16
3
156 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

810 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