Set the focus to the top of the form that has a tabcontrol

  • Thread starter Thread starter forest8
  • Start date Start date
F

forest8

Hi

I have a form which consists of a tab control.

When users switch between tabs, I want to set the focus of the entire form
to the top of the form each time instead of where they let the form on their
previous visit.

Is this possible?

I tried to set the focus to the top of the form by using the following:

Me.StudentID.SetFocus

But it doesn't work. I'm not sure of where I should put the code. Is this
the right one to use or would something else be better?

I also read somewhere in one of the forums I can set the focus first to the
mainform by using

Forms![MainFormName].Set focus

But I can't figure out where it should go?

Thank you for your help in advance.
 
"but it doesn't work" doesn't give us much to go on.

Clearly, you understand that you set the focus to a control, not to the "top
of the form".

Is [StudentID] the name of your control, or the field underlying it?

Have you tried:

Me!StudentID.SetFocus (the "!" tells Access that the object is one YOU
created)

Are there subforms involved? Where are you trying to use that code?

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
Back
Top