Code for Cmd button to select tab page on form? (1 Viewer)

Goli

New member
Local time
Today, 14:03
Joined
Jan 21, 2008
Messages
6
HI there,

I am still new to VBA and need some help.

I need to write some code which allows me to use a cmd button (using on Click) to select a tab page from a single form?

I have already got some code which allows the user to tab through each field and through each tab page on this single form, but I can't get the same thing to work on click from the cmd button.

Any Ideas?

Thanks for your time.

G

:confused:
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:03
Joined
Aug 30, 2003
Messages
36,125
This kind of thing?

Me.PageName.SetFocus
 

Goli

New member
Local time
Today, 14:03
Joined
Jan 21, 2008
Messages
6
Thanks,
Looks good!
How would I use this to set the focus for a specific tab and make sure the click button would take me there?
 

Goli

New member
Local time
Today, 14:03
Joined
Jan 21, 2008
Messages
6
Won't go back to the same tab page

I have tried this piece of code which works to an extent.

The only problem is that it doesn't always take you back to the same page,

It seems to take you to any page you have not yet tabbed through in the form?

Is there a way of making the command button always go to the one tab page?

Thanks,

G
 

boblarson

Smeghead
Local time
Today, 06:03
Joined
Jan 12, 2001
Messages
32,059
Um, Paul gave you the syntax - You use the tab's page name:

Me.YourTabPage.SetFocus

NOT the tab control name, but the name of the individual tab (known as a page).
 

Goli

New member
Local time
Today, 14:03
Joined
Jan 21, 2008
Messages
6
It's Alive!!

Thanks Guys!

I had a similar bit of code interfering with it on exit!

It wouldn't content with both.

Regards,

G

:D
 

Users who are viewing this thread

Top Bottom