|
 |
access thread: Waiting until the first process is done
Message #1 by "enZo :-\)" <enzaux@g...> on Wed, 19 Jun 2002 11:54:08 +0800
|
|
Hi! Is there anyway I could prolong or halt the next process until the prior process is not yet done. DoEvents is not working in
my case. Here is my scenario:
The text file that im going to import is zipped. Now I coded in vb the unzipping of the file then import the text file to my
table. Everything is coded, with just click of a button everything is done, the unzipping and the exporting. My problem is that
the unzipping process takes a little time to finish so I got an error for he next process (Importing) because the time it executes
the code for importing the file is not yet finished unzipping. How could I halt first before executing the next code?
BTW, I'm using WINZIP 8.1 and the command line add-on for my zipping and unzipping of files.
Thanks,
Enzo
Message #2 by "George Oro" <george@c...> on Wed, 19 Jun 2002 12:41:32 +0400
|
|
Enzo,
Your code is very interesting to me, actually I have an incoming project need this features. Can you share to me your code, if you
don't mind?
Cheers,
George
-----Original Message-----
From: enZo :-) [mailto:enzaux@g...]
Sent: Wednesday, June 19, 2002 7:54 AM
To: Access
Subject: [access] Waiting until the first process is done
Hi! Is there anyway I could prolong or halt the next process until the prior process is not yet done. DoEvents is not working in
my case. Here is my scenario:
The text file that im going to import is zipped. Now I coded in vb the unzipping of the file then import the text file to my
table. Everything is coded, with just click of a button everything is done, the unzipping and the exporting. My problem is that
the unzipping process takes a little time to finish so I got an error for he next process (Importing) because the time it executes
the code for importing the file is not yet finished unzipping. How could I halt first before executing the next code?
BTW, I'm using WINZIP 8.1 and the command line add-on for my zipping and unzipping of files.
Thanks,
Enzo
Message #3 by braxis@b... on Wed, 19 Jun 2002 09:51:40 +0100 (BST)
|
|
Enzo
Can you use the ShellWait function on the Access Web?
http://www.mvps.org/access/api/api0004.htm
Brian
> from: "enZo :-)" <enzaux@g...>
> date: Wed, 19 Jun 2002 04:54:08
> to: access@p...
> subject: Re: [access] Waiting until the first process is done
>
>
>
> Hi! Is there anyway I could prolong or halt the next process until the prior process is not yet done. DoEvents is not
working in
> my case. Here is my scenario:
>
> The text file that im going to import is zipped. Now I coded in vb the unzipping of the file then import the text file to my
> table. Everything is coded, with just click of a button everything is done, the unzipping and the exporting. My problem is
that
> the unzipping process takes a little time to finish so I got an error for he next process (Importing) because the time it
executes
> the code for importing the file is not yet finished unzipping. How could I halt first before executing the next code?
>
> BTW, I'm using WINZIP 8.1 and the command line add-on for my zipping and unzipping of files.
>
> Thanks,
>
> Enzo
>
>
>
Message #4 by "enZo :-\)" <enzaux@g...> on Wed, 19 Jun 2002 17:00:50 +0800
|
|
Yeah sure! But what part? The Zipping and Unzipping of exported text file? Try downloading first the Command Line Add-On of
WinZip at their website http://www.winzip.com/wzcline.htm
Tell me if this what you really want. I'll be happy to help.
Enzo :)
-----Original Message-----
From: George Oro [mailto:george@c...]
Sent: Wednesday, June 19, 2002 4:42 PM
To: Access
Subject: [access] RE: Waiting until the first process is done
Enzo,
Your code is very interesting to me, actually I have an incoming project need this features. Can you share to me your code, if you
don't mind?
Cheers,
George
-----Original Message-----
From: enZo :-) [mailto:enzaux@g...]
Sent: Wednesday, June 19, 2002 7:54 AM
To: Access
Subject: [access] Waiting until the first process is done
Hi! Is there anyway I could prolong or halt the next process until the prior process is not yet done. DoEvents is not working in
my case. Here is my scenario:
The text file that im going to import is zipped. Now I coded in vb the unzipping of the file then import the text file to my
table. Everything is coded, with just click of a button everything is done, the unzipping and the exporting. My problem is that
the unzipping process takes a little time to finish so I got an error for he next process (Importing) because the time it executes
the code for importing the file is not yet finished unzipping. How could I halt first before executing the next code?
BTW, I'm using WINZIP 8.1 and the command line add-on for my zipping and unzipping of files.
Thanks,
Enzo
Message #5 by "enZo :-\)" <enzaux@g...> on Wed, 19 Jun 2002 17:09:25 +0800
|
|
Brian,
Thanks Brian! But is there no much simplier code? Just askin if there are any :) because I dont know much on API's :)
But thanks for the link!!!
Thanks,
Enzo
YahooID: onstepcloser2insanity
-----Original Message-----
From: braxis@b... [mailto:braxis@b...]
Sent: Wednesday, June 19, 2002 4:52 PM
To: Access
Subject: [access] Re: Waiting until the first process is done
Enzo
Can you use the ShellWait function on the Access Web?
http://www.mvps.org/access/api/api0004.htm
Brian
> from: "enZo :-)" <enzaux@g...>
> date: Wed, 19 Jun 2002 04:54:08
> to: access@p...
> subject: Re: [access] Waiting until the first process is done
>
>
>
> Hi! Is there anyway I could prolong or halt the next process until the prior process is not yet done. DoEvents is not
working
in
> my case. Here is my scenario:
>
> The text file that im going to import is zipped. Now I coded in vb the unzipping of the file then import the text file to my
> table. Everything is coded, with just click of a button everything is done, the unzipping and the exporting. My problem is
that
> the unzipping process takes a little time to finish so I got an error for he next process (Importing) because the time it
executes
> the code for importing the file is not yet finished unzipping. How could I halt first before executing the next code?
>
> BTW, I'm using WINZIP 8.1 and the command line add-on for my zipping and unzipping of files.
>
> Thanks,
>
> Enzo
>
>
>
Message #6 by "Leo Scott" <leoscott@c...> on Tue, 18 Jun 2002 23:22:00 -0700
|
|
I am enclosing the code for a class that I use with Excel VBA. It uses a
couple of functions that are not in Access VBA
Application.OperatingSystem
and
Application.ScreenUpdating
It is using a command line program called PKZip25.exe. It does contain the
API code to wait until the process is done. If you cut and past the code
out to a file that ends in .cls you can from the project explorer right
click and import the file and then just modify it to meet your needs.
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "clsZip"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal _
hObject As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Private mstrZipName As String
Private mstrFileName As String
Private mstrZipPath As String
Private mstrFilePath As String
Public Property Let ZipName(ByVal NewName As String)
If Len(NewName) > 0 Then mstrZipName = NewName
End Property
Public Property Get ZipName() As String
ZipName = mstrZipPath & mstrZipName & ".zip"
End Property
Public Property Let FileToZip(ByVal FileName As String)
mstrFileName = FileName
End Property
Public Property Let ZipPath(ByVal NewZipPath As String)
mstrZipPath = NewZipPath
'make sure the path ends with a \
If Right(mstrZipPath, 1) <> "\" Then mstrZipPath = mstrZipPath & "\"
End Property
Public Property Let FilePath(ByVal NewFilePath As String)
mstrFilePath = NewFilePath
'make sure the path ends with a \
If Right(mstrFilePath, 1) <> "\" Then mstrFilePath = mstrFilePath & "\"
End Property
Public Sub Zip(Optional Move As Boolean = False)
Dim strcmd As String
Dim t As Single
Dim blnScrUpd As Boolean
blnScrUpd = Application.ScreenUpdating
'check that we have files to zip first
If mstrFileName <> "" Then
If mstrZipName = "" Then
If InStr(mstrFileName, ".") = 0 Then
mstrZipName = mstrFileName
Else
mstrZipName = Left(mstrFileName, InStr(mstrFileName, ".") - 1)
End If
End If
If mstrZipPath = "" Then mstrZipPath = mstrFilePath
If Dir(mstrFilePath & mstrFileName) <> "" Then
Select Case Application.OperatingSystem
Case "Windows (32-bit) 4.10" 'Windows 98SE
strcmd = "command.com /c pkzip25 -add -maximum "
Case "Windows (32-bit) NT 4.00" 'NT 4.0
strcmd = "cmd /c pkzip25 -add -maximum "
End Select
If Move Then strcmd = strcmd & "-move "
strcmd = strcmd & Chr(34) & mstrZipPath
strcmd = strcmd & mstrZipName & Chr(34)
strcmd = strcmd & " " & Chr(34)
strcmd = strcmd & mstrFilePath
strcmd = strcmd & mstrFileName & Chr(34)
Select Case Application.OperatingSystem
Case "Windows (32-bit) 4.10" 'Windows 98SE
Shell strcmd
Case "Windows (32-bit) NT 4.00" 'NT 4.0
ExecCmd strcmd
End Select
Application.ScreenUpdating = True
t = Timer
Do While Timer - t < 0.5
DoEvents
Loop
Application.ScreenUpdating = blnScrUpd
Else
Stop
End If
End If
End Sub
Private Sub ExecCmd(ByVal CMD As String)
Dim Proc As PROCESS_INFORMATION
Dim Start As STARTUPINFO
Dim ReturnValue As Integer
' Initialize the STARTUPINFO structure:
Start.cb = Len(Start)
' Start the shelled application:
ReturnValue = CreateProcessA(0&, CMD, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, Start, Proc)
' Wait for the shelled application to finish:
Do
ReturnValue = WaitForSingleObject(Proc.hProcess, 0)
DoEvents
Loop Until ReturnValue <> 258
ReturnValue = CloseHandle(Proc.hProcess)
End Sub
|-----Original Message-----
|From: enZo :-) [mailto:enzaux@g...]
|Sent: Tuesday, June 18, 2002 8:54 PM
|To: Access
|Subject: [access] Waiting until the first process is done
|
|
|
|
| Hi! Is there anyway I could prolong or halt the next
|process until the prior process is not yet done. DoEvents is not
|working in
|my case. Here is my scenario:
|
| The text file that im going to import is zipped. Now I
|coded in vb the unzipping of the file then import the text file to my
|table. Everything is coded, with just click of a button
|everything is done, the unzipping and the exporting. My problem is that
|the unzipping process takes a little time to finish so I got an
|error for he next process (Importing) because the time it executes
|the code for importing the file is not yet finished unzipping.
|How could I halt first before executing the next code?
|
| BTW, I'm using WINZIP 8.1 and the command line add-on for
|my zipping and unzipping of files.
|
|Thanks,
|
|Enzo
|
|
 |