setfocus on form control, not subform

C

CuriousMark

I have a form with a subform. After entering data in the subform the user
selects the next record or new record navigation button. The focus for the
new form stays on the subform, and does not move to the first tab order field
in the main form. I have tried various event procedures, including
Form_Update, Form_Activate, Form_Load, and Form_Open, but I can't get the
focus to move to the first field in the main form.
 
D

Dirk Goldgar

CuriousMark said:
I have a form with a subform. After entering data in the subform the user
selects the next record or new record navigation button. The focus for the
new form stays on the subform, and does not move to the first tab order
field
in the main form. I have tried various event procedures, including
Form_Update, Form_Activate, Form_Load, and Form_Open, but I can't get the
focus to move to the first field in the main form.


The Current event is the one you would want to use. Something like:

Private Sub Form_Current()

Me.YourPreferredControl.SetFocus

End Sub
 
J

John W. Vinson

I have a form with a subform. After entering data in the subform the user
selects the next record or new record navigation button. The focus for the
new form stays on the subform, and does not move to the first tab order field
in the main form. I have tried various event procedures, including
Form_Update, Form_Activate, Form_Load, and Form_Open, but I can't get the
focus to move to the first field in the main form.

I've fairly often seen it necessary to do TWO setfocus actions: first to the
desired form, then to the control on that form.
 
C

CuriousMark

Thanks. That worked. But I also modified the event processing module from the
Wedding database in the Viescas' Access 2003 so that I could view the events
for the form/subform combination. Form_Current() was the one that did it.
 

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