Results 1 to 13 of 13
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Running WinZIP from Access (Access 97/2000)

    Can WinZIP be controled from with Access?

    I am working on a import process. The files are sent ot the client as a zip file. I have the process set up to import the files, but I would like to take the extra step to unzip them as part of the import process.

    is this possible?

    Thanks for the help.

    Richard Aheron
    raheron@hotmail.com
    Richard

  2. #2
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Running WinZIP from Access (Access 97/2000)

    Just some ideas

    ... You can run a batch file to launch winzip from the Access application. You may be able to use the sendkeys command to send the keystrokes to unzip the file, however, how will the application know which file to unzip.

    Could you elaborate on how your import process will work. How does the client know which files to receive - all files in a particular directory, by selection, date, etc?? ... and will all files always be unzipped???

    I have some ideas but need to better understand what you are doing.

    HTH
    Regards,

    Gary
    (It's been a while!)

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running WinZIP from Access (Access 97/2000)


  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running WinZIP from Access (Access 97/2000)

    The code is set up to import files based on the names of the files. The zip file will contain the same six files each time. It is downloaded to the C:Temp folder. I would like to unzip the files to the same directory. The code will then go to that directory and import a given set of files.

    Thanks for the help
    Richard

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Running WinZIP from Access (Access 97/2000)

    If you want it to work in the background you need to get the winzip command line add-on, which can be downloaded from winzip.

    I have only used this from within Access to zip files, but you could also unzip them the same way. You can use the Shell command to run it from within Access. e.g.

    RetVal = Shell("c:Program filesWinzipwzzip -P -a " & strzipfileName & " " & strOldDbName, 1)
    Regards
    John



  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Running WinZIP from Access (Access 97/2000)

    Another alternative is to purchase a library to handle zipping and unzipping files from within Access. I've never tried to address the Winzip using wz32.dll, so I don't know whether there's a usable interface there for automation, but we use DynaZip at work and simply call the library functions from the dll.
    Charlotte

  7. #7
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Atlanta, Georgia, USA
    Posts
    274
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running WinZIP from Access (Access 97/2000)

    Stewart,
    I dont see any reference to GetCodeDBPath_TSB()
    Can you provide?
    Thanks,
    Scott

  8. #8
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Running WinZIP from Access (Access 97/2000)

    That's a very handy function to have, I used zip with the shell command at one stage but all I did was to wait a certain amount of time (substantially longer than I needed to actually), it solved the problem in a way (not the best way of course). <img src=/S/doh.gif border=0 alt=doh width=15 height=15>
    Again, well done. <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Running WinZIP from Access (Access 97/2000)

    It's probably a function from the FMS, Inc. Total SourceBook (The 97 version was called the Total Access Sourcebook, by the way). Their code all ends with a "_TSB" in the routine name. If you don't have it, you can pretty much infer what it does and build your own. Stewart can't post it here because the code is copyrighted.
    Charlotte

  10. #10
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Emerald Beach, New South Wales, Australia
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running WinZIP from Access (Access 97/2000)

    as charlotte said it's a fms function from their Sourcebook so I can't post it.

    In this case I use it to return the application path while building the path and name of the zip file. Alternately you could record this path in a parameter table and just pull the data out of the table when required.

    If you want to write a function that returns the running mdb path remember that the database name includes the full path as well as the mdb name.

  11. #11
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Emerald Beach, New South Wales, Australia
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running WinZIP from Access (Access 97/2000)

    um, I just realised after looking at the post I should not have posted that either as it came from the fms source book.

    I know over time I've used a couple of different functions & I thought that one was ok to post. Sorry FMS.

    There is a section on the Access web that deals with API calls and covers wait for shelled application.

    http://www.mvps.org/access/api/api0004.htm

    Edited by Charlotte to activate link

  12. #12
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Emerald Beach, New South Wales, Australia
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running WinZIP from Access (Access 97/2000)

    You can run winzip from the command line and as someone else answered you need the command line version that can be downloaded.

    I've restored files from a zip from within access as follows.

    Function Restore(fNam As String) As Boolean
    On Error GoTo Err_Restore

    Dim cmdLine As String
    Dim x As Boolean

    DoCmd.Hourglass True
    cmdLine = "crogram fileswinzipwinzip32 -e -o -j " & GetCodeDBPath_TSB() & "caabup" & fNam & " " & GetCodeDBPath_TSB()
    'GetCodeDBPath_TSB() & "caabup" & fNam = file path & name
    'GetCodeDBPath_TSB() = destination for unzip


    x = SysInfoWaitForApp_TSB(cmdLine, 3)

    DoCmd.Hourglass False

    Exit_Restore:
    Exit Function

    Err_Restore:
    Select Case Err
    Case Else
    MsgBox Error, vbCritical, Err & " - Restore"
    End Select

    End Function

    Private Function SysInfoWaitForApp_TSB(strCommandLine As String, intMode As Integer) As Boolean

    Code deleted as it should never have been posted.

    refer to http://www.mvps.org/access/api/api0004.htm
    for an alternative method.

    End Function

    Edited by Charlotte to activate link

  13. #13
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Running WinZIP from Access (Access 97/2000)

    Thanks for the edit, Stewart. We don't want anyone to get sued over posting copyrighted material ... especially US! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •