Setfocus to parent form

RevJeff

Registered User.
Local time
Today, 14:43
Joined
Sep 18, 2002
Messages
129
I'm trying to Setfocus to a certain Tab (Tab2) on a Tab Control that is located on the Main Form (Form1).

On the Tab Control I have a Subform (SubForm1) and on that Subform is another subform (SubForm2).

Main Form
Tab Control
SubForm1
SubForm2

So, I'm trying to set the focus from a field on SubForm2 to a field on Tab2 on the Tab Control.
 
I looked at that link already and I was a little confused. Do I type in the word "Parent" like this: Me.Parent.Parent!TabCtl0.SetFocus I'm guessing no, since that didn't work.

Also, once I get the Focus to the Tab Control, how do I set it to a certain tab?

Thanks
 
Rev,

I know exactly what you're going through. The reference on mvps doesn't talk about a subform on a subform.

I think you can use the expression builder to get the correct syntax. I have no clue how to use it, though. I did muddle through it one time and the expression it gave me worked when I pasted it into my code.

Try it out and if you have problems, give us a yell.
 
Hmmm .... I think you are almost there ...

Me.Parent.Parent!MainFormControlName.SetFocus

Instead of referencing the tab control, just reference the control you want focus to.

-dK
 
Good to go. I never investigated or anything, I have just always bypassed the focus to the Page (of the Tab) and focused on the control that I wanted. Sounds strange because each Page has it's own Tab ordering.

-dK
 

Users who are viewing this thread

Back
Top Bottom