How to reference a listbox on a Subform>TabPage>MainForm?

  • Thread starter Thread starter Robin
  • Start date Start date
R

Robin

Hi

I'm trying to reference a List Box which is on a subform, on a page of a tab
control, which is on a main form. I'm trying to use the List Box MouseMove
event to SetFocus on the list box and whichever syntax I try for the
reference the SetFocus gets ignored but without errors. (The MouseMove bit
is ok, but focus stays where it was previously.)

I've so far tried:

Forms!MainForm!SubForm!ListBox.SetFocus
Forms!MainForm!TabControl!SubForm!ListBox.SetFocus
Me!ListBox.SetFocus

Do I need to specifically reference the page involved, and if so how?

Regards

Robin
 
Robin said:
Hi

I'm trying to reference a List Box which is on a subform, on a page
of a tab control, which is on a main form. I'm trying to use the
List Box MouseMove event to SetFocus on the list box and whichever
syntax I try for the reference the SetFocus gets ignored but without
errors. (The MouseMove bit is ok, but focus stays where it was
previously.)
I've so far tried:

Forms!MainForm!SubForm!ListBox.SetFocus
Forms!MainForm!TabControl!SubForm!ListBox.SetFocus
Me!ListBox.SetFocus

Do I need to specifically reference the page involved, and if so how?

The TabControl doesn't enter into this at all, but you need to specify that you
want the form object inside the siubform control...

Forms!MainForm!SubForm.Form!ListBox.SetFocus

NOTE: The above uses the name of the subform *control* which is not guaranteed
to have the same name as the form inside it.
 
Back
Top