Making A form tab invisible/visible with a check box

J

jaythe0ne

Hi

I'm making a database for my football club, and have designed a form
for parent/guardian data, as the committee is made up of parents, i
thought it would be great to be able to have a check box for committee
members, that once checked, it reveals the hidden tab "Club Officials"
for further data input, i.e. committe position, crb details etc.

i've trolled the forums and thought i'd found the answer but it does
not seem to work properly.

All the data on the form comes from a table called guardians

For starters, i have made a check box on the form, and in the
properties set the control source to Club_Officer, which is a yes/no
data type in the table.

Heres the problem, i've used this code

Private Sub Check279_Click()
If Me.Check279 = "-1" Then
Me.Club_Official_tab.Visible = True
Else
Me.Club_Official_tab.Visible = False
End If
End Sub

Which makes the tab visible if the box is checked, however, it stays
visible for every record, it seems to be global.

i.e. Guardian 1 is a committee member and the box is checked, so the
committee members tab becomes visible. great, but when i goto guardian
2's record, the Committe tab is visible for that person aswell, event
though the box isn't checked, if i check and ubcheck the box, the tab
becomes invisible, but the going back to guardian 1 the tabs
disappeared aswell.

HELP! i;m going rapidly bald

Jason
 
J

jaythe0ne

In addition the Click event, use the form's OnCurrent event. Have code that
will look for Yes/No data and make the hidden tab visible or rehidden. This
event should fire when navigate to each record.

Thanks,

That worked a treat,

Jason

PS the code i used was

Private Sub Form_Current()
If Me.Check279 = "0" Then
Me.Club_Official_tab.Visible = False
Else
Me.Club_Official_tab.Visible = True
End If
End Sub

for anyone else with the same problem
 
P

Peter Hibbs

Jason,

As a matter of interest you could probably simplify your code by using
this :-

Me.Club_Official_tab.Visible = Me.Check279

This is because the Check box returns True or False and the Visible
property takes True or False so you can just copy one into the other.
If you wanted it the other way round you would use :-

Me.Club_Official_tab.Visible = Not Me.Check279

Just thought I would mention it.

Peter Hibbs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top