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

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.
 
J

Jeff Boyce

"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.
 

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

Similar Threads


Top