Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visibility Conditional on CBX value

Status
Not open for further replies.

brendoaccess

Technical User
Mar 28, 2006
27
GB
Hello - I thought this was simple - the following code is supposed to hide a button (MemberReport) and its label, if the value in a combo box (Combo81) equals "Bulletin". Unfortunately, it hides them whatever the value of Combo81 is!

Private Sub Form_Load()

If Me![Combo81] = "Bulletin" Then

Me![MemberReport].Visible = False
Me![Label58].Visible = False

Else

Me![MemberReport].Visible = True
Me![Label58].Visible = True


End If


End Sub

All help gratefully appreciated.
 
How are ya brendoaccess . . .

Nothing wrong with the code (note: you only need brackets [blue][][/blue]if there's a space(s) in the control name). Which means something is setting the combo to "Bulletin".

So when you open the form, just whats in the combo? . . . I'm expecting you to say nothing! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Hi, Aceman

There are 3 values in the combo to choose - "Bulletin", "Member" and "Bulletin and Member". I only have 2 records in the db and one is "Member" and one is "Bulletin".

If I change both records to member, the button and labels come back on re-opening the form. If I change the first record to bulletin, and re-open, the button/label disappear for both records. If I change the second record to Bulletin and re-open, the button/label is visible for both.


Once I get past this, I would like to have a bunch of labels and buttons that appear/disappear depending on whats in the combo.
 
If this is a continous form then this is normal behavior. There are work arounds using conditional formatting. If this is a single form consider the forms current event. If you use form load then it fires when the form loads and will run the code only once based on the value of the first record.
 
It is a single form, and On Current works just just Dandy. Many thanks MajP, and to you Aceman1 as well.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top