Closing a database

Posted on 1999-07-23
Medium Priority
Last Modified: 2010-04-30
I use VB5 with SP3.
Before backing up data, I close my database (db.Close). I do not use a network. However I often get an error 70 (permission denied). If I quit the application completely, and then restart the application, the backup works fine.

I have run the application with all error traps disabled. When the error occurs, I enter a further line of code (db.Close). This closes the database and the backup works correctly

How do I ensure that the database ALWAYS closes? I cannot close it twice as there will be an error if it has already been closed!
Question by:PeterN
1 Comment
LVL 12

Accepted Solution

mark2150 earned 200 total points
ID: 1527028
set db=nothing

Alternately turn on error traps just for that couple of lines

on error resume next
on error goto 0



Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

599 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