Set Focus to Sub-Form , How Do I ?

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

I have a main form named Employees that has (3) sub-forms on it. I want it
to goto the next sub-form on a keydown even procedure.
The sub-forms name is FNoAllowSub and the field I need to go to is named
NoAllow.
How do I make it do this ?

Thanks,

Dave
 
Hi Dave, this should do it. Note that you need to have the parent form
selected before you can set the focus to a child control

Forms![Employees].SetFocus ' select form
Forms![Employees].[FNoAllowSub].SetFocus ' select subfrom control on
Employees form
Forms![Employees].[FNoAllowSub].Form.[NoAllow].SetFocus ' select control
on subform

HTH, Graeme.
 
The code should be something like:

Me.FNoAllowSub.SetFocus
Me.FNoAllowSub.Form!NoAllow.SetFocus

*provided* that FNoAllowSub is the name of the Subform *Control* which can
be the same or different from the name of the Form you used as the Subform
(more accurately, you used as the SourceObject of the SubformControl).

OTOH, I would not recommend the KeyDown Event as the key you press will go
into the Control NoAllow if it accepts data entry (unless you cancel the
KeyCode).
 
Back
Top