Unanswered: Set tab order to new page on same form
I have a form with several subforms, each on a different tab page. I have the name of a patient at the top and then the tabbed pages with different information like procedures, contact, Etc.. that are all a subform. how do I set the tab order to go to the first item in the next page when you tab out of the last item on that page?
There may be better ways but you can do it with a couple lines of code.
Just set the following events on the last field on your form.
Dim key As Integer
Private Sub LastField_Enter()
If (key <> Null) Then key = Null
Private Sub LastField_Exit(Cancel As Integer)
If (key = 9) Then
Private Sub LastField_KeyDown(KeyCode As Integer, Shift As Integer)
key = KeyCode
If you leave by clicking somewhere else then nothing will happen, but if you are tabbing thru the fields the if statement in the exit event will execute and move you to the next form
Yes, you would have to update the names. Without knowing your form layout I was only able to guess what you called things.
In my example LastField is the name of the last text box on the first subform tab (where you want the action to start). Change this portion in all three events so the form code can find them.
You would also have to change ParentForm & NextForm insides the brackets of
Forms![ParentForm]![NextForm].SetFocus to match the name of your forms. ParentForm is the one that contains both of your forms, NextForm is the one you want to go to on the next tab.