Solved

Backup for Access file

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now