AOB
Registered User.
- Local time
- Today, 21:24
- Joined
- Sep 26, 2012
- Messages
- 615
Hi there,
I have a database which connects to another application (by creating an object) for the purposes of reading/writing data. Part of the code involves creating an instance of this application, and then taking input from the user via an Access form.
However, when I load the form, the focus stays with the other application, and the user has to 'click into' the form in order to reset the focus to the form and key the relevant details. Not the end of the world, granted, but frustrating over time and something I'd like to iron out.
I originally had this process in Excel, and used the following code to change the focus back to Excel (so that the user could key directly into the form)
But this doesn't apply to Access as it utilises the Application.Caption / AppActivate method to identify the appropriate window to switch back to. In Access, I don't have a caption to reference.
I've tried setting the focus in the Form_Load event but it doesn't bring the form 'to the fore'
Any suggestions?
Thanks
AOB
I have a database which connects to another application (by creating an object) for the purposes of reading/writing data. Part of the code involves creating an instance of this application, and then taking input from the user via an Access form.
However, when I load the form, the focus stays with the other application, and the user has to 'click into' the form in order to reset the focus to the form and key the relevant details. Not the end of the world, granted, but frustrating over time and something I'd like to iron out.
I originally had this process in Excel, and used the following code to change the focus back to Excel (so that the user could key directly into the form)
Code:
Dim ExcCap As String
ExcCap = Application.Caption
' ...assorted code, including creating the object to 'house' the other application...
' Return focus to Excel
AppActivate ExcCap
But this doesn't apply to Access as it utilises the Application.Caption / AppActivate method to identify the appropriate window to switch back to. In Access, I don't have a caption to reference.
I've tried setting the focus in the Form_Load event but it doesn't bring the form 'to the fore'
Code:
Private Sub Form_Load()
Me.SetFocus
End Sub
Any suggestions?
Thanks
AOB