moving between tab control pages automatically

  • Thread starter Thread starter OzPete
  • Start date Start date
O

OzPete

Hi all,

I want to set up a tab control set of pages, with a form on each one.

Is it possible to navigate, from say, page one "CLIENTS" to page two
"DEMOGRAPHICS" after updating the last field on page one and then focussing
on the first field on page two?

The two forms are based on two different tables, with the common denominator
'ClientCode', but I can get that one worked...

I know the user can 'click' on the tab controls to navigate, I am just
trying to make their data entry easier, rather than reaching for the mouse
or using keyboard shortcuts....

tia

OzPete
 
OzPete said:
Hi all,

I want to set up a tab control set of pages, with a form on each one.

Is it possible to navigate, from say, page one "CLIENTS" to page two
"DEMOGRAPHICS" after updating the last field on page one and then focussing
on the first field on page two?

The two forms are based on two different tables, with the common denominator
'ClientCode', but I can get that one worked...

I know the user can 'click' on the tab controls to navigate, I am just
trying to make their data entry easier, rather than reaching for the mouse
or using keyboard shortcuts....

Put a small TextBox on the form residing on the first page and make it last in
the Tab Order. In its GotFocus event have code that sets focus to the first
control on the form residing on the second tab page.

You can size and format the TextBox so it is not seen, but it's Enabled and
Visible properties must both be set to True.
 
I will just add that you can change to a different page by
changing Pages.Value. i can never remember if its zero or
one -based, but for example:

MyPages.Value = 1
MyPages.Value = 2

using lines like that will turn the page to whichever one
you specify (experiment or look it up to determine if its
zero or one based)

also i would recomend defining constants instead of using
hardcoded numeric values

ie, in some global module:

Global Const Page1 = 0
Global Const Page2 = 1

then you'd say
MyPages.Value = Page1

hope that helps!
 
Thanks Dave, I will try that one out, cos whilst Rick's idea is fine in
principle, it still cannot find the page

I tried

Forms![demographics]![clientcode].SetFocus

and it said it couldn't find the control on the current page! So if anyone
can suggest the correct syntax for the On Got Focus event on the last field
of the first form, and then also suggest a way for it to find the second
page 'Demographics', I would appreciate it!

OzPete
 
OzPete said:
Thanks Dave, I will try that one out, cos whilst Rick's idea is fine in
principle, it still cannot find the page

I tried

Forms![demographics]![clientcode].SetFocus

and it said it couldn't find the control on the current page! So if anyone
can suggest the correct syntax for the On Got Focus event on the last field
of the first form, and then also suggest a way for it to find the second
page 'Demographics', I would appreciate it!

If the control on the second tab page is also on a subform then you need
two lines of code. The first line needs to set focus to the subform itself
and the second line is needed to set focus to the desired control on the
subform.
 
Thanks Rick and Dave, once again...

I can now navigate from page one to page two... all I have to fix now is
why I can't go backwards from page two tp page one!....LOL
[seriously can't do it without lots of obsessive compulsive disorderly mouse
clicking!]

cheers lads

OzPete
 
Back
Top