Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling a tab control until criteria met

Status
Not open for further replies.

WallT

Vendor
Aug 13, 2002
247
0
0
US
Is there a way to Disable the tabs on a TabControl until my criteria has been met?

Here's what I want to do. There are a few tabs, and I want to force users to enter the data in the tab order I designate. Once the criteria is met...ie...mandatory fields are filled...then the next tab is enabled.

Or if I could just disable the tabs themselves, I guess I could add a command button...

Private Sub cmdPage2_Click()
Cancel = True
If My criteria is met THEN
Me.tabctlOrders.Value = 2
End If
Cancel = False

Any Suggestions?
 
You do not have to have tabs on a tab control. Pages can be accessed programatically through click events, say, for other controls.
 
How are ya WallT . . .

In design view hide all but the first page. The as validation on each page passes make visible the next page. The following is a starting point for each page:
Code:
[blue]   If YourValidationRoutine() = True Then
      Me!TabCtlName.Pages("NextPageName").visible=True
   Else
      Me!TabCtlName.Pages("NextPageName").visible=False
   End If[/blue]
Note: [blue]YourValidationRoutine()[/blue] is a routine called by all required fields on a page and returns true if they all validate, false otherwise.

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
I didn't think of that AceMan...I like it.

Also, Remou, I would love to know a little more about what you are saying. How can I have multple pages on a form for ONE RECORD?

That would work great for data entry on this project. I could then just have a Command Button that says "continue".
 
Many of us tend to think about tabbed pages as being vehicles for subforms, but this is just one of their uses!

Subforms aside, the big advantage of tabbed pages is that they're all part of a single form! Controls on tabbed pages are referenced as if they are all on a single screen! They allow you to segregate data into logical groups, and thus help to avoid "real estate clutter!" You could, for example, have one tabbed page for a job applicant's name, address and phone numbers, another page for their references, and another page yet for their job skills. And they're all part of a single record!

Here's a very short tutorial that I give people who are looking to use tabbed pages:

First thing to remember is that the Tabbed Pages are all part of a single form; think of it as a really long form turned on its side. Because it is all one form, all referrencing to any contol on it is done in the same manner as if they were all on one single screen. Create a form in Design View. Goto the toolbox and click on the Tabbed Control icon; it actually looks like several manila file folders. Place it on your form and adjust the size to your liking. If you need more than the two tabbed pages it initially gives you, click on the tabbed control to select it. Goto Insert and click on Tabbed Control Page and another tabbed page will be added. Do this as many times as neccessary.

This is the really important part: when you go to add a control to a tabbed page, you must first click to select one of the pages, then add the control. Otherwise, the control will be added to the form itself, and will show thru on all tabbed pages!

Once you have the form's Control Source (your table or a query) set up, you simple add controls as you normally would, heeding the above paragraph.


Good Luck!

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
WallT . . .

Since you appear to be collecting schema, consider this:

You can show all pages of your tab control ([blue]its aesthetically appealing to show all tabs[/blue]), but not allow page changes unless validation passes! Page changes would automatically be controlled by the previous page's validation, with the new page's validation taking over!

I have several db's out there in the corperate world where this was adamantly requested.

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
As a generalisation, most users seem to intuitively grasp what's happening, or expected of them, if they can see what's next, even if they can't access/edit it, as opposed to making things invisible.

I tend to do as aceman suggested, whether tabbed or not... users can see everything, but visual clues (disabling etc) indicate that something needs to be completed before they can move on and enter subsequent data.

Max Hugen
Australia
 
Consider a web page where you are shown that there are n pages to complete, but you are not shown the pages nor are you shown their contents.

It is possible to turn the tabs of a tab control off and to add either one or several other controls with click events (command buttons or labels, for example) to access the pages. These controls can then be manipulated via code as each page is completed. Tabs are quite limited for possible formats whereas other controls can be enabled or disabled, and colours and captions/contents can be changed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top