Label - Visible/NotVisible - Better Way

kaveman

Registered User.
Local time
Today, 04:32
Joined
May 12, 2004
Messages
58
I have a label on my report that I want to be visible for certain customers but not for others. I have everything working properly but it required a lot of typing so I am wondering...Is there a better way?

Here is the code I used:

If txtCustCode = 903 Or txtCustCode = 904 Or txtCustCode = 907 Then
Label461.Visible = False
Else
Label461.Visible = True
End If

This is just a sample using three customers, my actually if then statement consisted of 50 customers (I told you there was a lot of typing). So I know there has to be a better way to get this done. So everyone, how would you have done this better?

Thanks everyone, I appreciate all your help.
 
You could have a field to determine the whether or not the label is displayed or not. I don't know why/how it is determined.
 
I agree add a boolean field to your table called label visible. Mark it as true if you want the label visible and false if not. Then you can write code to check the value of this field to determine if the label should be visible.
 
Why not just use IsNull() to set label's visbility to false?
 
I agree a field would work best. The problem lies in the fact that this is not my DB, I just design reports around the data provided by the DB. So I am not able to add a field to a table. Is there a better way to do this using code or is my best bet to wait for the field to be added to a table by the DB programmer.
 
I just noticed a field that is not being used for anything at all. This should be perfect for what you are all recommending. Once again everyone's help saves the day. Thanks a bunch everyone.
 

Users who are viewing this thread

Back
Top Bottom