• Running WinZIP from Access (Access 97/2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Running WinZIP from Access (Access 97/2000)

    Author
    Topic
    #372575

    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

    Viewing 3 reply threads
    Author
    Replies
    • #596031

      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

      • #596132

        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

        • #596157

          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.

    • #596074
    • #596134

      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)

    • #596161

      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 = “c:program 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%5B/url%5D
      for an alternative method.

      End Function

      Edited by Charlotte to activate link

      • #596241

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

        • #596357

          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.

        • #596534

          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.

      • #596354

        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). doh
        Again, well done. clapping
        Pat cheers

        • #596535

          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%5B/url%5D

          Edited by Charlotte to activate link

          • #596538

            Thanks for the edit, Stewart. We don’t want anyone to get sued over posting copyrighted material … especially US! grin

    Viewing 3 reply threads
    Reply To: Running WinZIP from Access (Access 97/2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: