By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,155 Members | 2,518 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,155 IT Pros & Developers. It's quick & easy.

Zip Function

P: n/a
Rob
Hello,
I am trying to zip a folder(this folder contains several
files), from access application.This is as a part of back up
procedures which I am writing.I have written the timer program for
other functions .I wrote a code to utilize the WinZip exe.While it
zips the folder ,the folder does not exist after the zip procedure.I
want some help in tuning this code so that the original folder is
still retained in addition to the zipped one.Also ,I need to place a
copy of this zipped folder to another drive.Any help greatly
appreciated.

Thanks,

Rob
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
ch*******@yahoo.com (Rob) wrote:
I am trying to zip a folder(this folder contains several
files), from access application.This is as a part of back up
procedures which I am writing.I have written the timer program for
other functions .I wrote a code to utilize the WinZip exe.While it
zips the folder ,the folder does not exist after the zip procedure.I
want some help in tuning this code so that the original folder is
still retained in addition to the zipped one.Also ,I need to place a
copy of this zipped folder to another drive.Any help greatly
appreciated.


FWIW there are free alternatives which are open sourced and thus don't require
individual licenses. See Compression DLLs, OCXs, etc
http://www.granite.ab.ca/access/compression.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #2

P: n/a
ch*******@yahoo.com (Rob) wrote:
Also ,I need to place a
copy of this zipped folder to another drive.Any help greatly
appreciated.


See the Name statement. Hmm, different drive. See the FileCopy Statement.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #3

P: n/a
Try putting this in a module.
You will need to set Source Path, Source File and Backup Path to suit your own
set up
HTH
David B
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Public Function BackupAndZipittoC()

'This function will allow you to copy a db that is open,
'rename the copied db and zip it up to anther folder.

'You must set a reference to the 'Microsoft Scripting Runtime' for the CopyFile
piece to work!

'Thanks to Ricky Hicks for the .CopyFile code also G Hudson

Dim fso As FileSystemObject

Dim sSourcePath As String
Dim sSourceFile As String
Dim sBackupPath As String
Dim sBackupFile As String

sSourcePath = "C:\Hoofprint\"
sSourceFile ="Stock_be.mdb"
sBackupPath = "C:\Hoofprint\Backups"
sBackupFile = "Backupstock_" & Format(Date, "mmddyyyy") & "_" & Format(Time,
"hhmmss") & ".mdb"

Set fso = New FileSystemObject
fso.CopyFile sSourcePath & sSourceFile, sBackupPath & sBackupFile, True
Set fso = Nothing

Dim sWinZip As String
Dim sZipFile As String
Dim sZipFileName As String
Dim sFileToZip As String

sWinZip = "C:\Program Files\WinZip\WinZip32.exe" 'Location of the WinZip program
sZipFileName = Left(sBackupFile, InStr(1, sBackupFile, ".", vbTextCompare) - 1)
& ".zip"
sZipFile = sBackupPath & sZipFileName
sFileToZip = sBackupPath & sBackupFile

Call Shell(sWinZip & " -a " & sZipFile & " " & sFileToZip, vbNormalFocus)
MsgBox "Backup is proceeding. This routine can take up to 10 seconds to
complete"
Sleep 10000

If Dir(sBackupPath & sBackupFile) <> "" Then Kill (sBackupPath & sBackupFile)
Beep
MsgBox "Backup was successful and saved @ " & Chr(13) & Chr(13) & sBackupPath &
Chr(13) & Chr(13) & "The backup file name is " & Chr(13) & Chr(13) &
sZipFileName, vbInformation, "Backup Completed"

End Function

Rob <ch*******@yahoo.com> wrote in message
news:60**************************@posting.google.c om...
Hello,
I am trying to zip a folder(this folder contains several
files), from access application.This is as a part of back up
procedures which I am writing.I have written the timer program for
other functions .I wrote a code to utilize the WinZip exe.While it
zips the folder ,the folder does not exist after the zip procedure.I
want some help in tuning this code so that the original folder is
still retained in addition to the zipped one.Also ,I need to place a
copy of this zipped folder to another drive.Any help greatly
appreciated.

Thanks,

Rob


Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.