Subform and Tab Order

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
 
G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top