tab control options

  • Thread starter Thread starter cmichaud
  • Start date Start date
C

cmichaud

I was wondering if there was a way to make the tab pages active based
on what a user enters in other fields. the first tab page has a
control asking if it is a youth or adult. if the user selects adult i
want a tab page to be accessible (so they can enter more info) if they
select youth then they dont need to enter that info as it does not
pertain to a youth.

thanks
 
I was wondering if there was a way to make the tab pages active based
on what a user enters in other fields. the first tab page has a
control asking if it is a youth or adult. if the user selects adult i
want a tab page to be accessible (so they can enter more info) if they
select youth then they dont need to enter that info as it does not
pertain to a youth.

In the AfterUpdate event of the YouthAdult Control...

Me.TabControl.Pages("PageName").Visible = (Me!ControlName = "Adult")

You would likely need the same code in the Current event of the form so that the
TabPage Shows/Hides while you navigate records.
 
So it could it look something like this:

Me.TabControl.Pages("Training").Visible = (Me!PositionID = "Adult")
Me.TabControl.Pages("Membership").Visible = (Me!PositionID = "Youth")

Do i need a command telling them to hide the pages? Or is that the
default? For instance if the user selects adult is it going to hide
the membership tab??

thanks for your help...
 
This is what i put in the after event

Private Sub PositionID_AfterUpdate()
Me.TabControl.Pages("Training").Visible = (Me!PositionID = "Adult")
End Sub

It is not working. It gives an error than highlights !PositionID

any ideas? I checked the control name and it is right. It is saying
not finding control name
 
Where is PositionID? Do you have a subform on tab 1, and PositionID is in
that subform?
 
So it could it look something like this:

Me.TabControl.Pages("Training").Visible = (Me!PositionID = "Adult")
Me.TabControl.Pages("Membership").Visible = (Me!PositionID = "Youth")

Do i need a command telling them to hide the pages? Or is that the
default? For instance if the user selects adult is it going to hide
the membership tab??

thanks for your help...

The expressions...

(Me!PositionID = "Adult")
(Me!PositionID = "Youth")

....should evaluate to True or False which is then assigned to the visible
property of the page.
 
This is what i put in the after event

Private Sub PositionID_AfterUpdate()
Me.TabControl.Pages("Training").Visible = (Me!PositionID = "Adult")
End Sub

It is not working. It gives an error than highlights !PositionID

any ideas? I checked the control name and it is right. It is saying
not finding control name

"TabControl" needs to be replaced with the actual name of YOUR TabControl.
 
Me.TabCtl0.Pages("Training").Visible = (Me!PositionID = "Adult")

got that. sweet. but now.....if i select youth or adult the training
tab disappears......either selection will make it disappear
 
Me.TabCtl0.Pages("Training").Visible = (Me!PositionID = "Adult")

got that. sweet. but now.....if i select youth or adult the training
tab disappears......either selection will make it disappear

Sounds like you might be displaying one thing in Me!PositionID while the
actual value is something else. You need to match the actual stored value.
I assume this is an Integer value since you used "ID" in the name.
 
Back
Top