Hi All,
Thanks for reading this :)
I have a form A that consists of a main form A and a sub form A.
In sub form A, I have a field which I can double click. Then, Main form B opens up with a search field. Sub form B has a query as recordset. The query use the search field value as a filter, and the filter is updated every time text is entered into the search field.
What I want to happen is to set focus on the search field once form b is opened. I have tried this code.
I have also tried a combination of
1.
and
2. a OnEvent in Form B (tried all of them)
I have used F8 to go stepwise throug the whole code, and what happens then is that the macro first opens the form B, runs through the onevent and then goes back to Sub Dblclick which then ends.
However, I am unable to set focus on the search field either way.
I have a feeling it got to do something with the subform B... somehow. Because, if I hit ALT+Tab twice, the search field gets focus.
Any suggestions on where to troubleshoot or solve it?
Thanks in advance.
Martin
Thanks for reading this :)
I have a form A that consists of a main form A and a sub form A.
In sub form A, I have a field which I can double click. Then, Main form B opens up with a search field. Sub form B has a query as recordset. The query use the search field value as a filter, and the filter is updated every time text is entered into the search field.
What I want to happen is to set focus on the search field once form b is opened. I have tried this code.
Code:
Private Sub VismaID_DblClick(Cancel As Integer) DoCmd.OpenForm "Form B", acNormal Forms![Form B].[Search].SetFocus End Sub
1.
Code:
Private Sub VismaID_DblClick(Cancel As Integer) DoCmd.OpenForm "Form B", acNormal End Sub
2. a OnEvent in Form B (tried all of them)
I have used F8 to go stepwise throug the whole code, and what happens then is that the macro first opens the form B, runs through the onevent and then goes back to Sub Dblclick which then ends.
However, I am unable to set focus on the search field either way.
I have a feeling it got to do something with the subform B... somehow. Because, if I hit ALT+Tab twice, the search field gets focus.
Any suggestions on where to troubleshoot or solve it?
Thanks in advance.
Martin
Comment