Disable Tab pages

Dizzzy44

Registered User.
Local time
Today, 15:33
Joined
Apr 29, 2009
Messages
33
Hi All,

I'm a bit stuck with how to go about disabling tabs with in a tab page control in a form.

The form which the tab page control sits in is called 'frmDataEntry' and the tab control itself is called 'tab1'.

Now what I want is for the user to access data from a table through sub form 'frmsubIndicators' in form 'frmAdministration'. The subform is linked to data in a table called 'tblStdIndicators'. This table has two fields. The first is the name of the indicators (This is exactly the same as the tab page names) and the second is a checkbox which I want to use to enable and disable the tab pages dependent on which indicators are checked as enabled.

I was hoping to use the OnOpen event of the form with the table control to disable/enable tabs based on the checkbox selections in the Admin form. I imagine some sort of a loop that looks up the indicator name and checks if the enable check box is true or false and then disables/enables depending on the selection.

I'm a bit lost on how to go about this. Any help would be much appreciated.

Cheers
 
How many checkboxes? Is it on a subform set to datasheet or continuous view?
 
Put a textbox and checkbox on the form that is bound to the name of indicator and checkbox of the table (make them visible = false if you want). Then "On Current" do something like:

Code:
if checkbox.value = -1 then
if textbox.value = tabname1 then
    tabname1.enabled = false
elseif textbox.value  = tabname2 then
    tabname2.enabled = false
end if
'put all your possible tabnames in here
 
Put a textbox and checkbox on the form that is bound to the name of indicator and checkbox of the table (make them visible = false if you want). Then "On Current" do something like:

Code:
if checkbox.value = -1 then
if textbox.value = tabname1 then
    tabname1.enabled = false
elseif textbox.value  = tabname2 then
    tabname2.enabled = false
end if
'put all your possible tabnames in here
I think the OP has several tabs which he would like to enable or disable depending on the value of the respective checkboxes. This would require doing it once on the load event of the form instead of the current event. Which is why he/she thinks a loop is required.
 
vbaInet is correct. The part of my database where I want the user to specify what tab pages (indicators) will show up are in a completely different form only able to be accessed by an admin user. When the form loads I want some code to run that looks at a table which has all page names and a checkbox as the fields. The code should loop through this table and hide and disable any tab pages where the check box is not checked.
 
Try this tastey morsal straight from the Spent Geezers Association...
 

Attachments

No, OP stated that unchecked would not be enabled
Actually I shouldn't have asked, the OP clearly stated it here:

I was hoping to use the OnOpen event of the form with the table control to disable/enable tabs based on the checkbox selections in the Admin form. I imagine some sort of a loop that looks up the indicator name and checks if the enable check box is true or false and then disables/enables depending on the selection.

I'm sure you've got something for the OP in your db.
 
Try this tastey morsal straight from the Spent Geezers Association...
Just had a look at your db. Pink really?:eek: I like the "spent geeze assoc" though:D

Just to mention that you don't need that whole If... Else block there. All you do is:
Code:
With rst
     Do While Not .eof
          Me.Controls(![FieldWithNameOfControl]).Visible = ![YesNoField]
          .movenext
     Loop
End With
 
Yeah, wasn't sure if you could put the control names in there like that. Thanks.

I like pink.
 

Users who are viewing this thread

Back
Top Bottom