[AccessD] Automatic backup

Stuart McLachlan stuart at lexacorp.com.pg
Sat Mar 19 00:32:00 CDT 2016


Simnple VBA Zip compression - create an empty zip file and then use the shell to copy a file 
to it.

Just needs a Reference to Microsoft Shell Controls and Automation (Shell32.exe)


Function CreateNewZipFolder(Filename As String) As Long
Dim strEmptyZip As String
Open Filename For Binary As #1
strEmptyZip = Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String$(18, Chr$(0))
Put #1, , strEmptyZip
Close #1
End Function

Function AddFileToZipFolder(ZipFileName As String, Filename As String)
Dim oShellApp As Shell32.Shell
Set oShellApp = CreateObject("Shell.Application")
oShellApp.NameSpace(ZipFileName).CopyHere Filename
Set oShellApp = Nothing
End Function


On 18 Mar 2016 at 22:59, Bill Benson wrote:

> Good caveats. But I think given the specs it is just fine.
> 
> Wouldn't mind an acknowledge from Susan as I suspect it its the
> simplest method for her user!
> 
> Could even do Zip compression with one of Ron De Bruins routines
> saving ro compressed windows folder after .
> 
> Do this in a closing macro and done and done.
> 
>  You can't backup a currently opened DB.
> 
>  There's no locks held on a DB so you can do the file copy.   But if
>  another
> user is in, or even in your own process if any background tasks are
> processing, you might end up with an inconsistent DB.
> 
>  Of course you could do that in a small utility DB.
> 
> Jim.
> 
> -----Original Message-----
> From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf
> Of Bill Benson Sent: Thursday, March 17, 2016 12:11 PM To: Access
> Developers discussion and problem solving Subject: Re: [AccessD]
> Automatic backup
> 
> What is wrong with
> 
> Set FSO =CreateObject ("Scripting.FilesystemObject)
> On Error Resume Next
> Kill strPathtoBackupFile
> On Error Goto 0
> FSO.GetFile (currentDb.Name).Copy strPathtoBackupFile
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list