Here's a VB5 module that will do the trick. I'm not really an Access person - sorry.<br>
<br>
The ShellAndWaitFor function is the one to call.<br>
<br>
Regards<br>
<br>
Mike<br>
<br>
==snip==<br>
Attribute VB_Name = "ProcessControl"<br>
Option Explicit<br>
<br>
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long<br>
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long<br>
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long<br>
Private Declare Function CreateProcessBynum Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDirectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long<br>
Private Declare Function WaitForInputIdle Lib "user32" (ByVal hProcess As Long, ByVal dwMilliseconds As Long) As Long<br>
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long<br>
<br>
<br>
Private Const SYNCHRONIZE = &H100000<br>
Private Const INFINITE = &HFFFF ' Infinite timeout<br>
Private Const DEBUG_PROCESS = &H1<br>
Private Const DEBUG_ONLY_THIS_PROCESS = &H2<br>
Private Const CREATE_SUSPENDED = &H4<br>
Private Const DETACHED_PROCESS = &H8<br>
Private Const CREATE_NEW_CONSOLE = &H10<br>
Private Const NORMAL_PRIORITY_CLASS = &H20<br>
Private Const IDLE_PRIORITY_CLASS = &H40<br>
Private Const HIGH_PRIORITY_CLASS = &H80<br>
Private Const REALTIME_PRIORITY_CLASS = &H100<br>
Private Const CREATE_NEW_PROCESS_GROUP = &H200<br>
Private Const CREATE_NO_WINDOW = &H8000000<br>
Private Const WAIT_FAILED = -1&<br>
Private Const WAIT_OBJECT_0 = 0<br>
Private Const WAIT_ABANDONED = &H80&<br>
Private Const WAIT_ABANDONED_0 = &H80&<br>
Private Const WAIT_TIMEOUT = &H102&<br>
<br>
Private Type PROCESS_INFORMATION<br>
hProcess As Long<br>
hThread As Long<br>
dwProcessId As Long<br>
dwThreadId As Long<br>
End Type<br>
<br>
Private Type STARTUPINFO<br>
cb As Long<br>
lpReserved As String<br>
lpDesktop As String<br>
lpTitle As String<br>
dwX As Long<br>
dwY As Long<br>
dwXSize As Long<br>
dwYSize As Long<br>
dwXCountChars As Long<br>
dwYCountChars As Long<br>
dwFillAttribute As Long<br>
dwFlags As Long<br>
wShowWindow As Integer<br>
cbReserved2 As Integer<br>
lpReserved2 As Long<br>
hStdInput As Long<br>
hStdOutput As Long<br>
hStdError As Long<br>
End Type<br>
<br>
Public Function ShellAndWaitFor(Command As String) As Boolean<br>
<br>
Dim res As Long<br>
Dim RetVal As Boolean<br>
Dim sinfo As STARTUPINFO<br>
Dim pinfo As PROCESS_INFORMATION<br>
<br>
sinfo.cb = Len(sinfo)<br>
sinfo.lpReserved = vbNullString<br>
sinfo.lpDesktop = vbNullString<br>
sinfo.lpTitle = vbNullString<br>
sinfo.dwFlags = 0<br>
<br>
res = CreateProcessBynum(Command, vbNullString, 0, 0, True, NORMAL_PRIORITY_CLASS, _<br>
ByVal 0&, vbNullString, sinfo, pinfo)<br>
<br>
If (res = 1) Then<br>
WaitFor pinfo<br>
RetVal = True<br>
Else<br>
RetVal = False<br>
End If<br>
<br>
ShellAndWaitFor = RetVal<br>
<br>
End Function<br>
<br>
Private Sub WaitFor(pinfo As PROCESS_INFORMATION)<br>
Dim res As Long<br>
<br>
' Let the process initialize<br>
Call WaitForInputIdle(pinfo.hProcess, INFINITE)<br>
' Don't need the thread handle - so lose that straight off<br>
Call CloseHandle(pinfo.hThread)<br>
Do<br>
If WaitForSingleObject(pinfo.hProcess, 0) <> WAIT_TIMEOUT Then Exit Do<br>
DoEvents<br>
Loop While True<br>
<br>
' Kill the last handle of the process<br>
Call CloseHandle(pinfo.hProcess)<br>
<br>
' And relax<br>
<br>
End Sub<br>
==snip==<br>
<br>
<p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= > </a><br>