Set Focus to Sub-Form , How Do I ?

Set Focus to Sub-Form , How Do I ?

Post by Dave Ellio » Fri, 15 Aug 2003 08:12:04


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
 
 
 

Set Focus to Sub-Form , How Do I ?

Post by Graeme Ric » Fri, 15 Aug 2003 09:09:02

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.

 
 
 

Set Focus to Sub-Form , How Do I ?

Post by Van T. Din » Fri, 15 Aug 2003 09:11:37

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).
 
 
 

Set Focus to Sub-Form , How Do I ?

Post by Dave Ellio » Fri, 15 Aug 2003 10:20:31

Thanks, couldnt get to work though.



control