Solved

Backup for Access file

Posted on 1998-08-24
3
140 Views
Last Modified: 2010-04-30
I have a Visual basic CGI script that run a Access file.
When time goes , the size of Access file become larger and I need to create a self backup file for Access. Should I do some setting in Access file ? or add visaul basic command to
create the backup?
0
Comment
Question by:chyesoon
[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
3 Comments
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1430834
Hi,
1. From VB make a copy of the database from database.MDB to backup_my_data.MDB

2. use ZIP on the backup_my_data.MDB to save space.

3. Delete the  backup_my_data.MDB file.

If you need a source code for ZIP its here

  Option Explicit
  Dim ret3&
  Private Declare Function ShellExecute Lib "shell32.dll" Alias _
  "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _
   String, ByVal lpFile As String, ByVal lpParameters As String, _
   ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

   ' shayplace@hotmail.com or visit the home page  http://www.hili.com/~shay

   Private Sub cmdRunUnzip_Click()
   ' Run unzip program
    Dim YourFile
    On Error Resume Next
    YourFile = InputBox("Choose the file you want to run or if it a zip file to exteact.
'   For example to extract the zip file wav-zip.zip type in wav-zip.zip
'    More: try typing explorer.", "Run EXE", "")

    If YourFile = "" Then Exit Sub
        ret3& = ShellExecute(Me.hwnd, "Open", YourFile, "", App.Path, 1)
   End Sub

 Private Sub Form_Load()
 MsgBox "Files or programs must be in the path or the same directory as this program."
 End Sub


0
 
LVL 3

Expert Comment

by:rmichels
ID: 1430835
If you are going to copy the database in VB. Make sure you close it first before copying.

You may also want to consider using database replication (a microsoft tool)
0
 
LVL 2

Accepted Solution

by:
dabellei earned 180 total points
ID: 1430836
First thing to do is to compress the database once a while.  Each time you write somtehing in an access database the database will growth.  Even if you delete record it will growth you'll have to compress the database using the command compactdatabase

CompactDatabase db1, db2


0

Featured Post

Industry Leaders: 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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…
Suggested Courses
Course of the Month5 days, 16 hours left to enroll

626 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