Solved

Backup for Access file

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

706 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

18 Experts available now in Live!

Get 1:1 Help Now