Tab Controls question (1 Viewer)

WmRJohnson

New member
Local time
Today, 17:44
Joined
Apr 10, 2013
Messages
7
How can I accomplish this?

I have fields on a main form and fields on page (0) and page (1) of a tab control that are required. I've added some code that turns the labels red until the required fields are completed. My issue is that on page (1) the required fields aren't visible unless the user actually moves to that tab. I'd like to be able to in some way highlight the tab itself, either with a color or maybe have a clip-art picture appear in the tab when the fields are still null.

Possible?

Thanks
 

MSAccessRookie

AWF VIP
Local time
Today, 17:44
Joined
May 2, 2008
Messages
3,428
How can I accomplish this?

I have fields on a main form and fields on page (0) and page (1) of a tab control that are required. I've added some code that turns the labels red until the required fields are completed. My issue is that on page (1) the required fields aren't visible unless the user actually moves to that tab. I'd like to be able to in some way highlight the tab itself, either with a color or maybe have a clip-art picture appear in the tab when the fields are still null.

Possible?

Thanks

As far as I am aware, you can't do what you are looking to do. What you might be able to do is bring the Tab to the top and Set Focus to any Field that needs to be addressed.
 

WmRJohnson

New member
Local time
Today, 17:44
Joined
Apr 10, 2013
Messages
7
I thought of that, but the fact that I have required fields on both page(0) and page(1) means I'd have to select one or the other to set focus on. I was trying to learn the syntax for the tab control - .picture - thinking I could change the bitmap depending on the status of a particular field. Obviously I'll be able to live without this working, but always searching for new methods.

Thanks!
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:44
Joined
Feb 19, 2013
Messages
16,607
I have had this sort of issue in the past. There are a number of ways to handle it but my preferred solution is as follows:

For each tab which has the required fields create a rectangle control and place over the tab and set its back colour to 255 or whatever colour you want - I think it looks quite good if this is more of a bar rather than the full size of the tab and set along the top of the tab, but it is up to you. We'll call these controls Rect0, Rect1, etc. Make sure they are 'on top'

Depending on the way your form works, create a sub as follows and call it in your form on current event AND in each of the required fields after update event.

Code:
Private Sub SetTabs
    ' if result is zero set the backstyle to transparent (0) otherwise set to normal (1)
    Rect0.backstyle=abs((isnull(Fld1)+isnull(fld2))<0)
    Rect1.backstyle=abs((isnull(Fld3)+isnull(fld4))<0)
end sub

You'll need to change Fld1,2 etc to your field names and perhaps change the formula debending on your actual requirements (e.g. one of the fields might have it's default set to 0 in which case isnull(Fld) needs to be changes to fld=0)
 

WmRJohnson

New member
Local time
Today, 17:44
Joined
Apr 10, 2013
Messages
7
I like it. That's elegant and more importantly, I can understand it. Appreciate the help.

Bill
 

Simon_MT

Registered User.
Local time
Today, 22:44
Joined
Feb 26, 2007
Messages
2,177
You could change the form background or Header using three states

Colour1 / Image 1: Tab(0) Required fields Empty
Colour2 / Image 2: Tab(1) Required fields Empty
Colour3 / Image 3: Form complete

Simon
 

WmRJohnson

New member
Local time
Today, 17:44
Joined
Apr 10, 2013
Messages
7
I was unable to overlay the Tabs with a rectangle. The body of the tab control can accomodate a rectangle positioned forward, but the tabs themself always show on top. I used this method to show colored bars that peek above each of the tabs and that accomplishes my goal, but it sounded like you were able to over-lay the tabs with a coloured rectangle. Did I understand you correctly?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:44
Joined
Feb 19, 2013
Messages
16,607
Sorry, didn't think about that! - the rectangles should be created on the main form, not the tab, and then positioned over the tabs
 

WmRJohnson

New member
Local time
Today, 17:44
Joined
Apr 10, 2013
Messages
7
Perfect. We both did the same thing. That is where I positioned my rectangles.

and the best part is, I look like a genius! Thanks again

Bill
 

Users who are viewing this thread

Top Bottom