Tabbing order problem

a.phillips

Registered User.
Local time
Yesterday, 23:23
Joined
Jul 19, 2011
Messages
37
I am using Access 2003 as a front end, and SQL server management studio 2008 as back end.

I recently migrated the data from Access 97 (where the tabbing order worked fine).

In 2003 I have a problem with the tab order. If the user presses enter I want it to skip to the textbox in the subform, however if it is the last textbox in the subform, I want the focus to be set to first text box in the next subform. If the user presses tab (on any textbox), I wish it to go to the next subform.

The problem is when it sets the focus to the next subform, it misses the first field out, even though it is specified in the code, which textbox to set the focus to.

Here is what I have done so far:
- I have checked that the tabbing order is correct.
- In the code I have set the focus to the subform, before setting the focus to a field in the subform.
- I have tried setting the focus to another object, then to the desired object, this does not work.
- I have tried me.requery and me.refresh before setting the focus (This works on some objects but not all).

Here is the example of the code I have behind a text box:
Private Sub Lipid_Therapy_Combo_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Then
Me.Refresh
Me.Requery
[Forms]![info 2009]![other 2009].SetFocus
[Forms]![ info 2009]![other 2009]![Other 1].SetFocus
End If
End Sub

This workes on all of the textboxes in the subform, except for the one (the first one).

Does anyone have any suggestions on what to try?

Thanks
 
First of all you don't need the Me.Requery statement in the code. The first ..SetFocus statement sets focus on the sub-form and the first text box on the sub-form will be active, if the tabindex is set to 0. An explicit reference to the first text box in the code is not necessary. I very much doubt about the validity of the second .SetFocus statement.
 
Hi, I agree with you that if I set focus to the other subform, the focus should go to whatever object has the tab index of 0. But it doesn't, therefore once it set the focus to the correct object, but it doesn't seem it be working.

The problem only seems to be when tabbing from the first object (works fine on the 2nd and 3rd etc.) in the subform, to the first object in another subform (keeps setting focus to the 2nd one!).

This also happens when tabbing from a subform back to the original form, it skips one object.

Thanks
 
Last edited:
If anyone requires more information to answer the question, please ask.
 

Users who are viewing this thread

Back
Top Bottom