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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access 2007

Status
Not open for further replies.

CSteinwand

Technical User
Jun 19, 2010
3
US
I need help using the visibility feature.

I have a form and I want a label to become visible if the form has data in it, an invisible when it is blank. The code I have been trying is

If Me.Customer = Null Then
Me.Label29.Visible = False
Else
Me.Label29.Visible = True
End If
It doesn't work, I don't know if I have it on the right event. I have tried on form load, form open... Please help
Should I have the focus on the customer as I do here, or should the focus be on something else?
 
You probably want this in two places.
First on form load, so when the form is built, it doesn't "show" it then. Then you will need it in the After Update, or On Lost Focus event, depending on how you are controlling your form refresh.




Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
I tried this code in both places, onload, and onlostfocus and the label doesn't disappear. What am I doing wrong?
 
Are you refreshing the form? And/or the object?

Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
I have a subform that is based on a query that shows orders that are older than 7 days. I have a label that I want to become visible if the subform has any data. If not, then the label should not be visible. So far the only thing I have tried is basing the code on whether one of the fields has data in it, but that doesn't want to work and I don't know how to specify the form without including a field in the code. If it matters, the form is a continuous form. the name of the form is greaterthan7days and the name of the label is label29.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top