Unzip file with Access

A

alexhatzisavas

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
 
K

Klatuu

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
 
A

alexhatzisavas

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
 
D

Douglas J Steele

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
 
L

Larry Daugherty

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
 
K

Klatuu

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
 
D

Douglas J Steele

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
 
K

Klatuu

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
 
A

alexhatzisavas

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top