Unzip file with Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all.

Is it possible to use Access to automate the extraction of data from a
zipped file (WinZip) into a text file?

Thank you,
Alex
 
Conditionally, yes.
If you have licensed copy of Winzip, you can download a command line version
from their web site. Here is an example from an app I did about 7 years ago:

'Create the ZIP File

strZipPath = DLookup("[SYSVALUE]", "dfsys", "[SYSCODE]='MZIP_PROG'")
strZipFile = "ST" & DLookup("[SYSVALUE]", "dfsys",
"[SYSCODE]='MSDA_CODE'") & _
Format$(Date, "MMDD") & ".ZIP"
On Error Resume Next
intZipVal = Shell(strZipPath & "wzzip -yp " & strFoxProPath & strZipFile
& " " & strFoxProPath & "wd*.dbf", vbNormalFocus)
If intZipVal = 0 Or Err.Number = 53 Then
MsgBox "Could not Create ZIP File for State Transmission" & vbCrLf & _
"ZIP File May be Created Manually for Transmission",
vbExclamation, "Error"
End If
 
Klatuu, nice stuff, thanks.

Getting a licensed copy of WinZip will not be an issue.

Please educate me a bit and explain to me what a command-line version of
WinZip is and how it would be used.

If i understand correctly, your code creates the zipped file from within
Access.
The task, however, is to unzip into text format an already zipped file, and
to do this from within Access.
Am i missing something?

Again, many thanks.
Alex


Klatuu said:
Conditionally, yes.
If you have licensed copy of Winzip, you can download a command line version
from their web site. Here is an example from an app I did about 7 years ago:

'Create the ZIP File

strZipPath = DLookup("[SYSVALUE]", "dfsys", "[SYSCODE]='MZIP_PROG'")
strZipFile = "ST" & DLookup("[SYSVALUE]", "dfsys",
"[SYSCODE]='MSDA_CODE'") & _
Format$(Date, "MMDD") & ".ZIP"
On Error Resume Next
intZipVal = Shell(strZipPath & "wzzip -yp " & strFoxProPath & strZipFile
& " " & strFoxProPath & "wd*.dbf", vbNormalFocus)
If intZipVal = 0 Or Err.Number = 53 Then
MsgBox "Could not Create ZIP File for State Transmission" & vbCrLf & _
"ZIP File May be Created Manually for Transmission",
vbExclamation, "Error"
End If


alexhatzisavas said:
Hi all.

Is it possible to use Access to automate the extraction of data from a
zipped file (WinZip) into a text file?

Thank you,
Alex
 
http://www.winzip.com/downcl.htm

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


alexhatzisavas said:
Klatuu, nice stuff, thanks.

Getting a licensed copy of WinZip will not be an issue.

Please educate me a bit and explain to me what a command-line version of
WinZip is and how it would be used.

If i understand correctly, your code creates the zipped file from within
Access.
The task, however, is to unzip into text format an already zipped file, and
to do this from within Access.
Am i missing something?

Again, many thanks.
Alex


Klatuu said:
Conditionally, yes.
If you have licensed copy of Winzip, you can download a command line version
from their web site. Here is an example from an app I did about 7 years ago:

'Create the ZIP File

strZipPath = DLookup("[SYSVALUE]", "dfsys", "[SYSCODE]='MZIP_PROG'")
strZipFile = "ST" & DLookup("[SYSVALUE]", "dfsys",
"[SYSCODE]='MSDA_CODE'") & _
Format$(Date, "MMDD") & ".ZIP"
On Error Resume Next
intZipVal = Shell(strZipPath & "wzzip -yp " & strFoxProPath & strZipFile
& " " & strFoxProPath & "wd*.dbf", vbNormalFocus)
If intZipVal = 0 Or Err.Number = 53 Then
MsgBox "Could not Create ZIP File for State Transmission" & vbCrLf & _
"ZIP File May be Created Manually for Transmission",
vbExclamation, "Error"
End If


alexhatzisavas said:
Hi all.

Is it possible to use Access to automate the extraction of data from a
zipped file (WinZip) into a text file?

Thank you,
Alex
 
Plain vanilla Winzip does not accept arguments. With the command line
interpreter installed with Winzip you can pass in arguments. You
format the command within Access but you then Shell out to issue the
command. The command is executed by WinZip, not Access.

You need to look up the command repertoire and arguments available for
the CLI and compose the entire command line within Access and then
issue it using the Shell command as in Klatuu's example.

HTH
--
-Larry-
--

alexhatzisavas said:
Klatuu, nice stuff, thanks.

Getting a licensed copy of WinZip will not be an issue.

Please educate me a bit and explain to me what a command-line version of
WinZip is and how it would be used.

If i understand correctly, your code creates the zipped file from within
Access.
The task, however, is to unzip into text format an already zipped file, and
to do this from within Access.
Am i missing something?

Again, many thanks.
Alex


Klatuu said:
Conditionally, yes.
If you have licensed copy of Winzip, you can download a command line version
from their web site. Here is an example from an app I did about 7 years ago:

'Create the ZIP File

strZipPath = DLookup("[SYSVALUE]", "dfsys", "[SYSCODE]='MZIP_PROG'")
strZipFile = "ST" & DLookup("[SYSVALUE]", "dfsys",
"[SYSCODE]='MSDA_CODE'") & _
Format$(Date, "MMDD") & ".ZIP"
On Error Resume Next
intZipVal = Shell(strZipPath & "wzzip -yp " & strFoxProPath & strZipFile
& " " & strFoxProPath & "wd*.dbf", vbNormalFocus)
If intZipVal = 0 Or Err.Number = 53 Then
MsgBox "Could not Create ZIP File for State Transmission" & vbCrLf & _
"ZIP File May be Created Manually for Transmission",
vbExclamation, "Error"
End If


alexhatzisavas said:
Hi all.

Is it possible to use Access to automate the extraction of data from a
zipped file (WinZip) into a text file?

Thank you,
Alex
 
As it has already been pointed out, the command line version will allow you
to zip or unzip Winzip files. It is done outside Access using the Shell
function, but controlled from within Access.

alexhatzisavas said:
Klatuu, nice stuff, thanks.

Getting a licensed copy of WinZip will not be an issue.

Please educate me a bit and explain to me what a command-line version of
WinZip is and how it would be used.

If i understand correctly, your code creates the zipped file from within
Access.
The task, however, is to unzip into text format an already zipped file, and
to do this from within Access.
Am i missing something?

Again, many thanks.
Alex


Klatuu said:
Conditionally, yes.
If you have licensed copy of Winzip, you can download a command line version
from their web site. Here is an example from an app I did about 7 years ago:

'Create the ZIP File

strZipPath = DLookup("[SYSVALUE]", "dfsys", "[SYSCODE]='MZIP_PROG'")
strZipFile = "ST" & DLookup("[SYSVALUE]", "dfsys",
"[SYSCODE]='MSDA_CODE'") & _
Format$(Date, "MMDD") & ".ZIP"
On Error Resume Next
intZipVal = Shell(strZipPath & "wzzip -yp " & strFoxProPath & strZipFile
& " " & strFoxProPath & "wd*.dbf", vbNormalFocus)
If intZipVal = 0 Or Err.Number = 53 Then
MsgBox "Could not Create ZIP File for State Transmission" & vbCrLf & _
"ZIP File May be Created Manually for Transmission",
vbExclamation, "Error"
End If


alexhatzisavas said:
Hi all.

Is it possible to use Access to automate the extraction of data from a
zipped file (WinZip) into a text file?

Thank you,
Alex
 
Depending on the size of the archive, and what else the code is doing, you
might want to use http://www.mvps.org/access/api/api0004.htm rather than the
VBA Shell command to ensure that WinZip is finished executing before
carrying out the next step.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Klatuu said:
As it has already been pointed out, the command line version will allow you
to zip or unzip Winzip files. It is done outside Access using the Shell
function, but controlled from within Access.

alexhatzisavas said:
Klatuu, nice stuff, thanks.

Getting a licensed copy of WinZip will not be an issue.

Please educate me a bit and explain to me what a command-line version of
WinZip is and how it would be used.

If i understand correctly, your code creates the zipped file from within
Access.
The task, however, is to unzip into text format an already zipped file, and
to do this from within Access.
Am i missing something?

Again, many thanks.
Alex


Klatuu said:
Conditionally, yes.
If you have licensed copy of Winzip, you can download a command line version
from their web site. Here is an example from an app I did about 7 years ago:

'Create the ZIP File

strZipPath = DLookup("[SYSVALUE]", "dfsys", "[SYSCODE]='MZIP_PROG'")
strZipFile = "ST" & DLookup("[SYSVALUE]", "dfsys",
"[SYSCODE]='MSDA_CODE'") & _
Format$(Date, "MMDD") & ".ZIP"
On Error Resume Next
intZipVal = Shell(strZipPath & "wzzip -yp " & strFoxProPath & strZipFile
& " " & strFoxProPath & "wd*.dbf", vbNormalFocus)
If intZipVal = 0 Or Err.Number = 53 Then
MsgBox "Could not Create ZIP File for State Transmission" & vbCrLf & _
"ZIP File May be Created Manually for Transmission",
vbExclamation, "Error"
End If


:


Hi all.

Is it possible to use Access to automate the extraction of data from a
zipped file (WinZip) into a text file?

Thank you,
Alex
 
Good point, Douglas.

Douglas J Steele said:
Depending on the size of the archive, and what else the code is doing, you
might want to use http://www.mvps.org/access/api/api0004.htm rather than the
VBA Shell command to ensure that WinZip is finished executing before
carrying out the next step.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Klatuu said:
As it has already been pointed out, the command line version will allow you
to zip or unzip Winzip files. It is done outside Access using the Shell
function, but controlled from within Access.

alexhatzisavas said:
Klatuu, nice stuff, thanks.

Getting a licensed copy of WinZip will not be an issue.

Please educate me a bit and explain to me what a command-line version of
WinZip is and how it would be used.

If i understand correctly, your code creates the zipped file from within
Access.
The task, however, is to unzip into text format an already zipped file, and
to do this from within Access.
Am i missing something?

Again, many thanks.
Alex


:

Conditionally, yes.
If you have licensed copy of Winzip, you can download a command line version
from their web site. Here is an example from an app I did about 7 years ago:

'Create the ZIP File

strZipPath = DLookup("[SYSVALUE]", "dfsys", "[SYSCODE]='MZIP_PROG'")
strZipFile = "ST" & DLookup("[SYSVALUE]", "dfsys",
"[SYSCODE]='MSDA_CODE'") & _
Format$(Date, "MMDD") & ".ZIP"
On Error Resume Next
intZipVal = Shell(strZipPath & "wzzip -yp " & strFoxProPath & strZipFile
& " " & strFoxProPath & "wd*.dbf", vbNormalFocus)
If intZipVal = 0 Or Err.Number = 53 Then
MsgBox "Could not Create ZIP File for State Transmission" & vbCrLf & _
"ZIP File May be Created Manually for Transmission",
vbExclamation, "Error"
End If


:


Hi all.

Is it possible to use Access to automate the extraction of data from a
zipped file (WinZip) into a text file?

Thank you,
Alex
 
I see, very insightful.

Klatuu, Douglas, Larry, thank you very much.

I'll delve into the mysteries of WinZip 10.0 Pro and see what i can do.

Alex


Klatuu said:
Good point, Douglas.

Douglas J Steele said:
Depending on the size of the archive, and what else the code is doing, you
might want to use http://www.mvps.org/access/api/api0004.htm rather than the
VBA Shell command to ensure that WinZip is finished executing before
carrying out the next step.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Klatuu said:
As it has already been pointed out, the command line version will allow you
to zip or unzip Winzip files. It is done outside Access using the Shell
function, but controlled from within Access.

:


Klatuu, nice stuff, thanks.

Getting a licensed copy of WinZip will not be an issue.

Please educate me a bit and explain to me what a command-line version of
WinZip is and how it would be used.

If i understand correctly, your code creates the zipped file from within
Access.
The task, however, is to unzip into text format an already zipped file, and
to do this from within Access.
Am i missing something?

Again, many thanks.
Alex


:

Conditionally, yes.
If you have licensed copy of Winzip, you can download a command line version
from their web site. Here is an example from an app I did about 7 years ago:

'Create the ZIP File

strZipPath = DLookup("[SYSVALUE]", "dfsys", "[SYSCODE]='MZIP_PROG'")
strZipFile = "ST" & DLookup("[SYSVALUE]", "dfsys",
"[SYSCODE]='MSDA_CODE'") & _
Format$(Date, "MMDD") & ".ZIP"
On Error Resume Next
intZipVal = Shell(strZipPath & "wzzip -yp " & strFoxProPath & strZipFile
& " " & strFoxProPath & "wd*.dbf", vbNormalFocus)
If intZipVal = 0 Or Err.Number = 53 Then
MsgBox "Could not Create ZIP File for State Transmission" & vbCrLf & _
"ZIP File May be Created Manually for Transmission",
vbExclamation, "Error"
End If


:


Hi all.

Is it possible to use Access to automate the extraction of data from a
zipped file (WinZip) into a text file?

Thank you,
Alex
 
Back
Top