Solved

Backup for Access file

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 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