SetFocus is ignored

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

Guest

I have textboxes in the Form Header of the Main Form ; and have a SubForm in
the Detail Section.

On the last box in the header area I put in the OnExit event:

Me.SubForm.Form!ABCtextbox.SetFocus

....and it is ignored...no error or anything...the tab returns to the first
box in the Form Header....

If I put my cursor in the subForm's ABCtextbox, everything is fine and it
does not have the tab stop turned off or anything...

Any suggestions?
 
Is there anything else happening at the time?
For example, moving record, loading the form, applying a filter/sort, or
saving the record?

Is this last control bound to a field?

Does this only occur when there are no records?

It should work. You could try the LostFocus event.
 
To set focus to a control in a subform when you're in the main form, you
must first set focus to the subform control, then set focus to the control
in the subform:

Me.SubForm.SetFocus
Me.SubForm.Form!ABCtextbox.SetFocus
 
If I'm not mistaken, I believe you have set focus to the subform itself
first, then to the control within the subform like;

Me!SubForm.SetFocus
Me!SubForm.Form!ABCtextbox.SetFocus

BTW - is "SubForm" the actual name of your subform?

HTH
 
aha - first set focus to the overall subform...

that's a headslap d'oh !

thanks all 3 ; works
 
Back
Top