Subform and Tab Order

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form which contains a subform. I want users to be able to 'Tab'
through the textboxes on the subform and then have the cursor move on to the
texboxes on the form as 'Tab' continues to be pressed. I have used the
following code in the last textbox on the subform's OnKeyDown Event to get
the cursor to proceed to the form:
If KeyCode = 9 Or KeyCode = 13 then
Forms![MainFormname]![TextFieldName].SetFocus
End If

This almost works. When 'Tab' is pressed the cursor skips the textbox
specified in [TextFieldName] and moves on to the next text box according to
the Tab Index. The Tab Stop for the skipped textbox is set to Yes. How can I
fix this?

TIA
 
Try this
If KeyCode = 9 Or KeyCode = 13 then
KeyCode = 0
Forms![MainFormname]![TextFieldName].SetFocus
End If

to set the KeyCode to 0 so the TAB wont work after you set the focus
 
BRILLIANT!!

Thanks so much

Ofer Cohen said:
Try this
If KeyCode = 9 Or KeyCode = 13 then
KeyCode = 0
Forms![MainFormname]![TextFieldName].SetFocus
End If

to set the KeyCode to 0 so the TAB wont work after you set the focus
--
HTH, Good Luck
BS"D


rwilliams said:
I have a form which contains a subform. I want users to be able to 'Tab'
through the textboxes on the subform and then have the cursor move on to the
texboxes on the form as 'Tab' continues to be pressed. I have used the
following code in the last textbox on the subform's OnKeyDown Event to get
the cursor to proceed to the form:
If KeyCode = 9 Or KeyCode = 13 then
Forms![MainFormname]![TextFieldName].SetFocus
End If

This almost works. When 'Tab' is pressed the cursor skips the textbox
specified in [TextFieldName] and moves on to the next text box according to
the Tab Index. The Tab Stop for the skipped textbox is set to Yes. How can I
fix this?

TIA
 
Back
Top