Solved

Backup for Access file

Posted on 1998-08-24
3
135 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
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 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…

770 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