Make Tabs Visible

LQ

Registered User.
Local time
Today, 22:49
Joined
Apr 5, 2001
Messages
145
I think this should be possible, just not sure where to put the code...I have a form with five tabs. For most records, only one or two of the tabs are filled in. Is there a way to make only the tabs that have information on them visible? Would I check a key field on each tab to see if it's null, and if it is, make that tab invisible? And what would happen as the users navigated through various records? How would I make tabs appear and disappear as needed?

Thanks for any ideas!
 
Each tab has its own Visible property, which you can set or reset in code as needed. I have an application where the tabs to be displayed vary with the characteristics of the current record, so I simply inspect those characteristics and set or reset the tabs' Visible properties in the form's OnActivate event procedure.
 
So it would be the form's On Activate event? Not the On Current? I have to say, I find some of the event properties confusing. And this code in the On Activate event would be triggered each time someone navigated to a different record? And what if someone needed to start a new tab on a record (that is not currently displaying the tab because it's empty)?

Thanks
 
Sorry about that - my mistake. It should be the OnCurrent event (which fires each time a new record is displayed) rather than the OnActivate event (which fires each time the form gets the focus and becomes the active form).

If you have a different set of rules to apply (vis-a-vis which tabs should be visible) on new versus existing records, you can use NewRecord property, which indicates whether or not the current record is a new one. For example:

If Me.NewRecord Then
'code here executes only for new records
Else
'code here executes only for existing records
End If
 

Users who are viewing this thread

Back
Top Bottom