Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2007

Tip: Looking for answers? Try searching our database.

zips failing to unzip

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pubdude2003 - 28 Jan 2007 14:17 GMT
hey all,

I have written a small db that downloads zip files from a site and then
automatically creates a directory and unzips a file into that directory,
except the last bit doesn't seem to be working. It does it all but the
unzipping. The debug indicates it should work but no such luck.

The portion of the code that unzips definitely works because I use the exact
same snippet in a loop in another form, fires fine.

Any thoughts would be appreciated.

  On Error GoTo ErrHandler
  Dim cnts1 As String
  Dim cnts2 As String
  Dim strPath As String
  Dim strPath2 As String
  Dim aFolders() As String
  Dim I As Integer
  Dim objHTTP As HTTP
  Set rs = Me.RecordsetClone

  If Not rs.EOF Then rs.MoveFirst
  While Not rs.EOF
  rs.Edit
   
  cnts1 = InStr(rs!Contents, "http://tpod.dirxion.com/results.asp?jobid=")
  cnts2 = Mid$(rs!Contents, cnts1 + 42, 5)
  Set objHTTP = New HTTP
  With objHTTP
   .HttpURL = "http://www.someplace.com/hunterpool/" & cnts2 & ".zip"
   .DestinationFile = "C:\2\" & cnts2 & ".zip"
   '.PromptWithCommonDialog = True
   If .FileExists Then .OverwriteTarget = True
   If Not .IsConnected Then .DialDefaultNumber
   .ConnectToHTTPHost
   .WriteHTTPDataToFile
  End With
  rs![Content Unread] = 20 'just a box that turns red when this record is
done
  rs.Update
     
   strPath = "C:/1/"
   strPath = strPath + cnts2
         
  aFolders = Split(strPath, "\")
  strPath = vbNullString

  For I = LBound(aFolders) To UBound(aFolders)
      strPath = strPath & aFolders(I)
      If Len(Dir(strPath, vbDirectory)) = 0 Then
      MkDir strPath
      End If
      strPath = strPath & "/"
  Next I
   DoEvents

   strPath2 = ("C:\2\" & cnts2 & ".zip")
     Call UnzipIt(strPath2, strPath)

     Debug.Print UnzipIt(strPath2, strPath)

     rs.MoveNext

     Wend
 
  Requery
  rs.Close
  Set rs = Nothing

ExitHere:
 On Error Resume Next
 Set objHTTP = Nothing
 Call SysCmd(acSysCmdRemoveMeter)
 Exit Sub
ErrHandler:
If Err.Number = 6 Then
Resume
End If
 MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly, Err.
source
 Resume ExitHere

debug
C:\2\88888.zip
C:/1/88888/
C:\2\88888.zip
C:/1/88888/
False
pubdude2003 - 29 Jan 2007 00:35 GMT
ah, got it... needed

  Set objHTTP = Nothing

after the end with
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.