Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Focus on Subform 2

Status
Not open for further replies.

BobJacksonNCI

Technical User
Mar 11, 2003
725
US
Hi!

My answer is probably here already ... somewhere ...

I have a Form + Subform that is used to view existing data AND enter new subform records. Not that it is important, but the Form is proloaded with no entry/editing allowed.

When the >* button (custom) is selected to enter a new form, the focus is on a Close button on the Form. I'd like the focus to be on the first Subform field.

Form = frm_TIME_OFF

Subform = frm_TIME_OFF_Subform

Control = txtDateRequested

Usually I'm not too lazy to search for the answer, but I've had a long, tiring day.

Assistance, please, and Thanks In Advance!
 
Bob
I think it would be something like this...

Since the subform is a control on the main form, I think you have to first set focus on the subform control...
Forms!frm_TIME_OFF!frm_TIME_OFF_Subform.SetFocus

and then
Forms!frm_TIME_OFF!frm_TIME_OFF_Subform!txtDateRequested.SetFocus


Tom
 
Just for preferences (mine), and to add to THWatsons suggestion, using the Form keyword when referencing subform controls often disambiguate the reference:

[tt]forms!frm_TIME_OFF!frm_TIME_OFF_Subform.Setfocus
forms!frm_TIME_OFF!frm_TIME_OFF_Subform.Form!txtDateRequested.Setfocus[/tt]

or using the Me keyword:

[tt]Me!frm_TIME_OFF_Subform.Setfocus
Me!frm_TIME_OFF_Subform.Form!txtDateRequested.Setfocus[/tt]

- and - remember the previous discussion on usage of subform control name vs subform name, if that might be an issue here too;-)

Roy-Vidar
 
Thank you, THWatson and RoyVidar!!

Since having to develop a Form + Subform in an Access Project, I began to hate them. With the help of you two, I've learned to tolerate them!

Who knows where this could lead? ==> [smarty]

Stars warranted for timely and accurate replies.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top