set focus to subform

  • Thread starter Thread starter SuzyQ
  • Start date Start date
S

SuzyQ

I want code in the on exit event of a field in frmEmployeeProjects (subform
and parent) which is a subform of frmTimeSheet (parent).

Form frmEmployeeProjects has a subform named
frmTimeSheetsSubFormProjectEquipment

I want to set focus to the subform frmTimeSheetsSubFormProjectEquipment I
have tried several different ways and I get messages like
frmTimeSheetsSubFormProjectEquipment can't be found or invalid method

How can I set focus from frmEmployeeProjects to
frmTimeSheetsSubFormProjectEquipment which is a subform of
frmEmployeeProjects which is a subform of frmTimeSheet?
 
Hi Suzy

Have you tried:

Me!frmTimeSheetsSubFormProjectEquipment.SetFocus ?

Note that frmTimeSheetsSubFormProjectEquipment should match the name of the
subform container control, which is not necessarily the same as the name of
the subform that it contains.
 
I must have had an ! when I should have had a . or visa versa. But this
worked. Thanks.

Graham Mandeno said:
Hi Suzy

Have you tried:

Me!frmTimeSheetsSubFormProjectEquipment.SetFocus ?

Note that frmTimeSheetsSubFormProjectEquipment should match the name of the
subform container control, which is not necessarily the same as the name of
the subform that it contains.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

SuzyQ said:
I want code in the on exit event of a field in frmEmployeeProjects (subform
and parent) which is a subform of frmTimeSheet (parent).

Form frmEmployeeProjects has a subform named
frmTimeSheetsSubFormProjectEquipment

I want to set focus to the subform frmTimeSheetsSubFormProjectEquipment I
have tried several different ways and I get messages like
frmTimeSheetsSubFormProjectEquipment can't be found or invalid method

How can I set focus from frmEmployeeProjects to
frmTimeSheetsSubFormProjectEquipment which is a subform of
frmEmployeeProjects which is a subform of frmTimeSheet?
 
One more question though... is there a way to set focus to a specific field
on a form rather than just to the form?

I want set focus back to subform frmEmployeeProjects which is one level up
from frmTimeSheetsSubFormProjectEquipment but I want to go to a specific
field (one after the field that sets focus to the equipment form.

Graham Mandeno said:
Hi Suzy

Have you tried:

Me!frmTimeSheetsSubFormProjectEquipment.SetFocus ?

Note that frmTimeSheetsSubFormProjectEquipment should match the name of the
subform container control, which is not necessarily the same as the name of
the subform that it contains.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

SuzyQ said:
I want code in the on exit event of a field in frmEmployeeProjects (subform
and parent) which is a subform of frmTimeSheet (parent).

Form frmEmployeeProjects has a subform named
frmTimeSheetsSubFormProjectEquipment

I want to set focus to the subform frmTimeSheetsSubFormProjectEquipment I
have tried several different ways and I get messages like
frmTimeSheetsSubFormProjectEquipment can't be found or invalid method

How can I set focus from frmEmployeeProjects to
frmTimeSheetsSubFormProjectEquipment which is a subform of
frmEmployeeProjects which is a subform of frmTimeSheet?
 
Hi Suzy

I haven't coded this for a while so I'm relying on memory (which isn't what
it used to be! :-)

I think you set focus to the subform control and THEN to the control on the
subform:

Me!MySubform.SetFocus
Me!MySubform.Form!MyControl.SetFocus
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

SuzyQ said:
One more question though... is there a way to set focus to a specific
field
on a form rather than just to the form?

I want set focus back to subform frmEmployeeProjects which is one level up
from frmTimeSheetsSubFormProjectEquipment but I want to go to a specific
field (one after the field that sets focus to the equipment form.

Graham Mandeno said:
Hi Suzy

Have you tried:

Me!frmTimeSheetsSubFormProjectEquipment.SetFocus ?

Note that frmTimeSheetsSubFormProjectEquipment should match the name of
the
subform container control, which is not necessarily the same as the name
of
the subform that it contains.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

SuzyQ said:
I want code in the on exit event of a field in frmEmployeeProjects
(subform
and parent) which is a subform of frmTimeSheet (parent).

Form frmEmployeeProjects has a subform named
frmTimeSheetsSubFormProjectEquipment

I want to set focus to the subform frmTimeSheetsSubFormProjectEquipment
I
have tried several different ways and I get messages like
frmTimeSheetsSubFormProjectEquipment can't be found or invalid method

How can I set focus from frmEmployeeProjects to
frmTimeSheetsSubFormProjectEquipment which is a subform of
frmEmployeeProjects which is a subform of frmTimeSheet?
 
however in this case I'm in the bottom level subform and want to set focus up
one level to its parent which is a subform of the main form. Any suggestions?

I.E. Main Form -> Subform -> Subform's Subform

I'm in the subform's subform and want to get to a specific field in the
subform.

Graham Mandeno said:
Hi Suzy

I haven't coded this for a while so I'm relying on memory (which isn't what
it used to be! :-)

I think you set focus to the subform control and THEN to the control on the
subform:

Me!MySubform.SetFocus
Me!MySubform.Form!MyControl.SetFocus
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

SuzyQ said:
One more question though... is there a way to set focus to a specific
field
on a form rather than just to the form?

I want set focus back to subform frmEmployeeProjects which is one level up
from frmTimeSheetsSubFormProjectEquipment but I want to go to a specific
field (one after the field that sets focus to the equipment form.

Graham Mandeno said:
Hi Suzy

Have you tried:

Me!frmTimeSheetsSubFormProjectEquipment.SetFocus ?

Note that frmTimeSheetsSubFormProjectEquipment should match the name of
the
subform container control, which is not necessarily the same as the name
of
the subform that it contains.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

I want code in the on exit event of a field in frmEmployeeProjects
(subform
and parent) which is a subform of frmTimeSheet (parent).

Form frmEmployeeProjects has a subform named
frmTimeSheetsSubFormProjectEquipment

I want to set focus to the subform frmTimeSheetsSubFormProjectEquipment
I
have tried several different ways and I get messages like
frmTimeSheetsSubFormProjectEquipment can't be found or invalid method

How can I set focus from frmEmployeeProjects to
frmTimeSheetsSubFormProjectEquipment which is a subform of
frmEmployeeProjects which is a subform of frmTimeSheet?
 
however in this case I'm in the bottom level subform and want to set focus up
one level to its parent which is a subform of the main form. Any suggestions?

I.E. Main Form -> Subform -> Subform's Subform

I'm in the subform's subform and want to get to a specific field in the
subform.

Me.Parent.SetFocus
Me.Parent!controlname.SetFocus
 
John W. Vinson said:
Me.Parent.SetFocus
Me.Parent!controlname.SetFocus


I don't believe you need to set the focus to the parent in this case. Just:
Me.Parent!controlname.SetFocus

.... should do it (unless that's changed in Access 2007).
 
Thanks John and Dirk. I won't be able to try this until Monday, but I
appreciate the help. I'll followup if necessary.
 
salut jai un probleme jai telecharger un anti virus payant a pc tools je veu
resilier labonnement mai je trouve pas en plu c un abonnement 1 an a 29.95
par moi au secour comment je doit faire
SuzyQ said:
Thanks John and Dirk. I won't be able to try this until Monday, but I
appreciate the help. I'll followup if necessary.
 
Me.Parent.SetFocus - 'This code gave error message "invalid method in
expression"
thanks to all
 
Back
Top