In after updated event of a text box, I use shell command to open a document (a pdf or drawing of the product) on a second monitor.
When the pdf is opened, Windows moves the focus to the recently opened document. So I have to click MS Access window again to set the focus on it and be able to continue inputting next text boxes.
Is there any way to bring back focus to Access window after opening a pdf file?
This is the code I'm using at present :
Thanks for any kind of advice.
When the pdf is opened, Windows moves the focus to the recently opened document. So I have to click MS Access window again to set the focus on it and be able to continue inputting next text boxes.
Is there any way to bring back focus to Access window after opening a pdf file?
This is the code I'm using at present :
Rich (BB code):
Declare PtrSafe Function apiShellExecute 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
Public Sub PrintFile( _
ByVal FileName As String, _
Optional PrintShow As String = "Open")
Call apiShellExecute(hWndAccessApp, PrintShow, FileName, vbNormalNoFocus, vbNullString, vbNormalNoFocus)
End Sub
Thanks for any kind of advice.