Selecting Page on Tab Control

J

JamesJ

I have a Tab Control on my form.
When the form opens I want the first page (index 0) to be selected
as though one clicks on the tab.
How might I accomplish this?

Thanks,
James
 
K

Ken Snell [MVP]

Use the form's Load event to set the value of the tab control's Value
property to 0.
 
J

JamesJ

That works fine but I need to have the tab selected as though I clicked on
it.
I don't want any data to be selected on the page which is whyt happens
using this. I want the tab to be selected so that the dotted box (for lack
of
a better term) is on the tab.

James
 
J

JamesJ

Setting the focus doesn't accomplish my goal, either.
I tried that before.
I need to simulate clicking the tab and I found no code for that.
If one has an enabled field either on a tab page or on a form one
can't prevent the text from being selected.
I've tried setting the focus to a hidden field but that don't work.
This is basically for cosmetic reasons 'cause the field is Locked so
the data can't be changed. I was just hoping there was something
I could do to prevent this.

James
 
J

Jeanette Cunningham

Hi JamesJ,
if you want to set focus, instead of using a hidden field which won't take
the focus, create a transparent command button and make it small and call it
cmdFocus.

Then you can just go Me.cmdFocus.Setfocus

Use error handling to trap error number 2110 as there may be a reason why
access can't set focus to this control.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

JamesJ

I couldn't find any methods either but Jeanette gave me an idea.
Created a transparent command button and stuck it behind the Tab Control.
Then set the focus to it in the OnLoad

James
 
J

JamesJ

That worked. Created the Button and hid it behind the Tab Control
Actually, I probably could have even used an unbound text box as long as
it was hidden.
Error trapping? What's that? Oh yeah, that code I have none of.
No errors so far.

James
 

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