Tab order in sub form

J

JoeA2006

I built a form that allows the user to be able to switch a record from one
subform to another. I coded Combo boxes in each subform for the selection
criteria to Requery itself and any of the other subforms the record may have
been switched to .

The code in the after update event in the combo box is

Me.Requery
Forms!Form1.[subformA].Requery
Forms!Form1.[subFormB].Requery

This seem to work fine, but after a new record is entered, instead of the
tab going from the last text box in the row to the next row, the tab jumps to
the combo box in the first record. I have set the tab order as Combo1
Combo2 Text1 Text2. Combo 1 contains the criteria for changing the record to
a different subform
I would like the user to just be able to tab and enter a new record on the
next row, instead of tabbing down through the whole subform.
 
T

tina

when you requery a form's RecordSource, the focus automatically moves to the
first record in the "new" recordset that's returned by the requery action.
you can force the focus to the "bottom" of the recordset, as

Me.Requery
DoCmd.RunCommand acCmdRecordsGoToNew
Forms!Form1.[subformA].Requery
Forms!Form1.[subFormB].Requery

one question: is your code running in Combo1's AfterUpdate event? or in the
*form's* AfterUpdate event? given the tab order you described, seems that if
the code were running in the control's event, you'd never be able to
complete the record.

hth
 
J

JoeA2006

Yes, when I add the GoToNew command the focus goes to a new record, but the
focus changes right after I select from the ComboBox. So my next question is,
in which control and what event do I use to run the requery after all the
data is entered? Will it work in the afterupdate event of the main form? So
then I will have to add the reference to the subform instead of "Me"?
Thanks

tina said:
when you requery a form's RecordSource, the focus automatically moves to the
first record in the "new" recordset that's returned by the requery action.
you can force the focus to the "bottom" of the recordset, as

Me.Requery
DoCmd.RunCommand acCmdRecordsGoToNew
Forms!Form1.[subformA].Requery
Forms!Form1.[subFormB].Requery

one question: is your code running in Combo1's AfterUpdate event? or in the
*form's* AfterUpdate event? given the tab order you described, seems that if
the code were running in the control's event, you'd never be able to
complete the record.

hth


JoeA2006 said:
I built a form that allows the user to be able to switch a record from one
subform to another. I coded Combo boxes in each subform for the selection
criteria to Requery itself and any of the other subforms the record may have
been switched to .

The code in the after update event in the combo box is

Me.Requery
Forms!Form1.[subformA].Requery
Forms!Form1.[subFormB].Requery

This seem to work fine, but after a new record is entered, instead of the
tab going from the last text box in the row to the next row, the tab jumps to
the combo box in the first record. I have set the tab order as Combo1
Combo2 Text1 Text2. Combo 1 contains the criteria for changing the record to
a different subform
I would like the user to just be able to tab and enter a new record on the
next row, instead of tabbing down through the whole subform.
 
T

tina

well, either i was asleep when i answered your first post, or i'm asleep
now. if you're in one subform (subformA), entering a new record, and you
want to requery the current subform and another subform (subformB) (both on
the same main form) after the new record has been entered, then i suggest
trying the following code in subformA's AfterUpdate event procedure, as

Me.Requery
Me.Parent!subformB.Form.Requery
DoCmd.RunCommand acCmdRecordsGoToNew

hth


JoeA2006 said:
Yes, when I add the GoToNew command the focus goes to a new record, but the
focus changes right after I select from the ComboBox. So my next question is,
in which control and what event do I use to run the requery after all the
data is entered? Will it work in the afterupdate event of the main form? So
then I will have to add the reference to the subform instead of "Me"?
Thanks

tina said:
when you requery a form's RecordSource, the focus automatically moves to the
first record in the "new" recordset that's returned by the requery action.
you can force the focus to the "bottom" of the recordset, as

Me.Requery
DoCmd.RunCommand acCmdRecordsGoToNew
Forms!Form1.[subformA].Requery
Forms!Form1.[subFormB].Requery

one question: is your code running in Combo1's AfterUpdate event? or in the
*form's* AfterUpdate event? given the tab order you described, seems that if
the code were running in the control's event, you'd never be able to
complete the record.

hth


JoeA2006 said:
I built a form that allows the user to be able to switch a record
from
one
subform to another. I coded Combo boxes in each subform for the selection
criteria to Requery itself and any of the other subforms the record
may
have
been switched to .

The code in the after update event in the combo box is

Me.Requery
Forms!Form1.[subformA].Requery
Forms!Form1.[subFormB].Requery

This seem to work fine, but after a new record is entered, instead of the
tab going from the last text box in the row to the next row, the tab
jumps
to
the combo box in the first record. I have set the tab order as Combo1
Combo2 Text1 Text2. Combo 1 contains the criteria for changing the
record
to
a different subform
I would like the user to just be able to tab and enter a new record on the
next row, instead of tabbing down through the whole subform.
 

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