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

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
 
R

Rick Brandt

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top