Ok Ladies and Gentlemen
The Shell function opens an executable program using…
Private Function OpenPayroll()
‘Open the Payroll program
strAppName = "MSACCESS.exe"
strPath = "C:\My Files\Private\Payroll\"
strAppType = "mdb"
strFileName = "Payroll" & "." & strAppType
strConCan = strAppName & " " & Chr(34) & strPath & strFileName & Chr(34)
Call Shell(strConCan, 1) ‘Open Payroll
End Function
If you repeat the shell function, Windows opens a second copy of the application. Not Good!
In Access Visual Basic For Apps (VBA)
If PayrollLoaded Then ‘Function to return True if Application is loaded?
‘SetFocus on Loaded Program
Call SetFocusOnPayroll ‘What Code Goes Here?
Else
Call OpenPayroll ‘Call the OpenPayroll function
Call SetFocusOnPayroll
End If
Thanks a bunch,
Richard
The Shell function opens an executable program using…
Private Function OpenPayroll()
‘Open the Payroll program
strAppName = "MSACCESS.exe"
strPath = "C:\My Files\Private\Payroll\"
strAppType = "mdb"
strFileName = "Payroll" & "." & strAppType
strConCan = strAppName & " " & Chr(34) & strPath & strFileName & Chr(34)
Call Shell(strConCan, 1) ‘Open Payroll
End Function
If you repeat the shell function, Windows opens a second copy of the application. Not Good!
In Access Visual Basic For Apps (VBA)
- How do you check if a specific program is currently loaded?
- How do you change focus from the MDB that has the focus to the MDB that is loaded (Payroll) and does not have the focus?
If PayrollLoaded Then ‘Function to return True if Application is loaded?
‘SetFocus on Loaded Program
Call SetFocusOnPayroll ‘What Code Goes Here?
Else
Call OpenPayroll ‘Call the OpenPayroll function
Call SetFocusOnPayroll
End If
Thanks a bunch,
Richard