Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with using Winzip through Access VB

Status
Not open for further replies.

bujin

MIS
Oct 2, 2000
144
GB
As part of added functionality to my database, I have a backup facility from the menu which currently copies the database to a separate location. I have added the code to compress the copy into a Winzip file, but I'm having a little difficulty.

I have a line to run Winzip (using the Shell command), then the following line deletes the old MDB file. The problem is that while winzip is loading in the background, the code jumps to the next line and deletes the MDB file before it has had a chance to be zipped up.

Are there any commands in VB to make the program halt while Winzip loads up and creates the zip file? I want it to pause until Winzip shuts down again, then carry on with the rest of the code.

Thx
 
Provoke the error!

Sub ProvokeError()
On Error GoTo Err_ProvokeError
Dim RetVal

RetVal = Shell("C:\Program Files\WinZip\WinZip32", vbNormalFocus)
Do
'Activate App Window while it's opened
AppActivate RetVal
Loop

CotinueProgram:
'Continue program
'Next codes


Exit_ProvokeError:
Exit Sub

Err_ProvokeError:
If Err.Number = 5 Then 'Invalid procedure call or argument:
'result of "AppActivate RetVal" when App Window is closed

Resume CotinueProgram
Else
MsgBox "Error No " & Err.Number & vbLf & Err.Description, , "Sub ProvokeError"

End If
End Sub


Aivars
 
Well, I tried it, but unfortunately it does not work. The problem now is that when Winzip loads up the splash-screen (it's unregistered) it doesn't allow me to click on the Agree button to continue loading the application - it just locks up.

I'll have to stick with giving the user a time limit to load Winzip, then contain the errors if it fails. It won't be much of a problem for the time-being, as I'm the only one who will have access to that part of my database, but if I leave my job and someone else takes over it...

Thanks again for your help.
 
Hmmm...
I also have unregistered WinZip. First call time I took error, too. But next times all work OK. Just now I tried to run this command again >>> OK.

Aivars
 
Hi again!

I'm not understanding why didn't I say yesterday about archiver ARJ (nice thing). It works perfectly and lets to create multidisk archives by command rows. How I know this archiver also may be registered and unregistered. I use it for backups long ago. In addition unlike WinZip it don't require insert first diskette, last diskette, first diskette... during zip and unzip. During file compressing by using Shell() method what I posted yesterday (see above) do immaculately.

Look at sites

Aivars
 
Aivars: thanks for that, but unfortunately, I'm a bit limited in what I can use, because we're not allowed to download applications onto the computers here in work.

Rick39: thanks for your response too. I pasted the code into my program and it works perfectly.

Thanks again to both of you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top