Go Back   Access World Forums > Microsoft Access Reference > Code Repository

 
Closed Thread
 
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
Old 03-04-2006, 07:17 PM   #1
keiths
Registered User
 
Join Date: Feb 2005
Posts: 28
Thanks: 0
Thanked 8 Times in 8 Posts
keiths is on a distinguished road
Thumbs up Backup & Restore using ZIP

I came across a very neat activex dll that can be used for zipping and unzipping files (especially backend databases). The nice thing about this one is it works very well with access. The other nice thing is that it is free.

Go to the following url: http://xstandard.com

In their products listing is an activex dll called "zip component".

Here is some basic information on using it. The specs, documentation and other information is provided on their web site.

1) Copy the dll to a folder or location of your choice. Use regserver or a utility to register it.

2) In the database you wish to use it, open a module. Select Tools - References. Find a listing for "XStandard - Zip 2.5" and check it. Select OK. Compile the module.

You are now ready to use it in your vba code. Here is a simple example that works for zipping a backend database.

Public cp as XZip.Zip

Function BackMeUp()

Set cp = New XZip.Zip

cp.Pack "C:\testdata\backend-db.mdb", "C:\backup\backup.zip"

Set cp = Nothing

End Function

That is it. A couple lines of code, and it works well. Of course, you can do similar stuff with unzipping. The instructions cover the basic info you need. It works well with string variables, etc etc.

There has been a lot of discussion in the past surrounding this issue. I have tried a lot of different dll's, ocx's etc in the past year. This one is pretty seamless. I am sure anyone interested can come up with lots of ideas while using this.

This company also has a couple of other items that access programmers will find interesting and useful. Maybe someone can post information on their use here as well.

keiths is offline  
The Following User Says Thank You to keiths For This Useful Post:
tkargsr (07-01-2011)
Old 06-05-2006, 04:18 AM   #2
bonekrusher
Registered User
 
Join Date: Nov 2005
Posts: 266
Thanks: 0
Thanked 0 Times in 0 Posts
bonekrusher is on a distinguished road
I would like to add a little more to this post. This is a great way to zip contents. I use this with Ghudson browsing example to gather the folder contents. I gather the contents of the folder and record the links in a table called "holdtable". It will drop the zip contents in a folder called "Backups" which resides in the same folder as the database. It will name the zip file "File Folder Backup-date.zip"

Once its done, it deletes the "holdtable"

Here is the code to zip the links in the "holdtable":

Code:
Dim objZip As ZIP 'uses xstandard xip 2.4 dll
Dim rrst As DAO.Recordset
Dim dfol As String
Dim strDayPrefix As String
strDayPrefix = Format(Date, "mm-dd-yyyy")


pathloc = "File Folder Backup-" & strDayPrefix
pathb = path & "\backups\"
dfol = pathb & pathloc 

Set objZip = New XZip.ZIP
Set rrst = CurrentDb.OpenRecordset("holdtable")

    While Not rrst.EOF
    objZip.Pack rrst![Hold], dfol & ".zip", , 9
    rrst.MoveNext
    Wend

DoCmd.SetWarnings False
DoCmd.OpenQuery ("deletetable")
Set objZip = Nothing
bonekrusher is offline  
Closed Thread

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stumped on backup code Malcy Modules & VBA 1 10-02-2005 07:13 AM
Reverse of BackUp and zip to A drive Rachael Modules & VBA 2 06-19-2004 08:41 PM
Backup and Restore SteveClarkson Tables 1 03-25-2003 07:48 AM
Restore Backup BackEnd Access File RadPro General 1 07-12-2002 05:16 AM
backup and restore AsP Modules & VBA 0 02-27-2002 08:59 AM




All times are GMT -8. The time now is 12:50 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World