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
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
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Suggested Courses

719 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