Solved

What could cause being unable to close a Recordset?

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

726 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