Taken from :
Hope this helps
Here's how to shell to another program from Access, stop your code while the shelled process operates and then resume your code once the process is finished. To do this you use the api functions "WaitforSingleObject", and "OpenProcess" to launch a shelled process and wait for it to complete. Listed below is the code to use.
1. On the declarations page of your module, add the following functions:
Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal _
dwAccess As Long, ByVal fInherit As Integer, ByVal hObject _
As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal _
hObject As Long) As Long
2. Try out this test function, which launches any app you want to and waits until it is finished to display a message box (Note an " _ " underscore means line continuation):
Function LaunchApp32 (MYAppname As String) As Integer
On Error Resume Next
Const SYNCHRONIZE = 1048576
Const INFINITE = -1&
Dim ProcessID&
Dim ProcessHandle&
Dim Ret&
LaunchApp32=-1
ProcessID = Shell(MyAppName, vbNormalFocus)
If ProcessID<>0 then
ProcessHandle = OpenProcess(SYNCHRONIZE, True, ProcessID&)
Ret = WaitForSingleObject(ProcessHandle, INFINITE)
Ret = CloseHandle(ProcessHandle)
MsgBox "This code waited to execute until " _
& MyAppName & " Finished",64
Else
MsgBox "ERROR : Unable to start " & MyAppname
LaunchApp32=0
End If
End Function
3. It is important to note that your function must include the code to close the process handle after the shelled application is complete, otherwise you will have a memory leak until you shut down Windows.