Tab page visible

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Using Access 2002 we have a form containing a tab control which has 12
pages.

When the user clicks on a New button for a new record focus is set onto the
1st Page.

What we want to achieve is that when when the New Button is clicked only the
1st page is visible and only when all fields on the 1st page contain data
are the other 11 pages visible.

What is best practise to hide the 11 pages and later to make them visible

Any advice would be appreciated

TIA

Tom
 
Tom said:
Using Access 2002 we have a form containing a tab control which has 12
pages.

When the user clicks on a New button for a new record focus is set
onto the 1st Page.

What we want to achieve is that when when the New Button is clicked
only the 1st page is visible and only when all fields on the 1st page
contain data are the other 11 pages visible.

What is best practise to hide the 11 pages and later to make them
visible

Any advice would be appreciated

TIA

Tom

Hiding the pages could be done with code along the lines of

Dim i As Integer

With Me.tabMyTabControl.Pages
For i = 1 To .Count - 1
' Note: tab pages are numbered from 0 to (Count - 1)
.Item(i).Visible = False
Next i
End With

Showing them would be the same, except that you'd use "True" instead of
"False". You could write a function to which you would just pass True
or False as an argument, if you wanted.

The next question is how you are going to know when all the controls on
the first page are completed. Unless the controls on the first page are
all on a bound subform, in which case you may be able to use the
subform's AfterUpdate event to run your code, you'll probably need to
have a function that you call from the AfterUpdate event of every data
control on the page, checking whether *all* have now been filled out.
 
Wow Dirk that was quick!

Will try the code out

What is being planned is that the 1st page contains 4 bound text boxes the
data of which is used to generate a reference no. That page also has a label
giving the user instructions When that reference no is generated the other
11 pages become visible..... or can you suggest plan B?

Thanks again

Tom
 
Tom said:
Wow Dirk that was quick!

Will try the code out

What is being planned is that the 1st page contains 4 bound text
boxes the data of which is used to generate a reference no. That page
also has a label giving the user instructions When that reference no
is generated the other 11 pages become visible..... or can you
suggest plan B?

I'm not terribly fond of generating calculated "intelligent key" fields
like your reference number, and saving them. But your circumstances may
require it, and I don't want to get into a long discussion of it. Aside
from that issue, I don't see anything wrong with your plan. I'm
guessing you could define a function in the General section of your
form's module, which would check to see if all the fields have been
filled in, and if they have, generate the reference number and show the
other tab pages. This function could be called directly from the
AfterUpdate event of the four text boxes. by specifying their
AfterUpdate event properties as a function expression like:

=CheckForCompleteRefNo()

or something like that.
 
Dirk

Thanks again for the advice

Tom

Dirk Goldgar said:
I'm not terribly fond of generating calculated "intelligent key" fields
like your reference number, and saving them. But your circumstances may
require it, and I don't want to get into a long discussion of it. Aside
from that issue, I don't see anything wrong with your plan. I'm
guessing you could define a function in the General section of your
form's module, which would check to see if all the fields have been
filled in, and if they have, generate the reference number and show the
other tab pages. This function could be called directly from the
AfterUpdate event of the four text boxes. by specifying their
AfterUpdate event properties as a function expression like:

=CheckForCompleteRefNo()

or something like that.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top