Label Visible on Condition!

B

Bob

Is it possible to have a Visible Condition on a Label on a form, that is
subject to a List box on another form having data in it
Thanks for any help........Bob
 
F

fredg

Is it possible to have a Visible Condition on a Label on a form, that is
subject to a List box on another form having data in it
Thanks for any help........Bob

You haven't indicated what the List Box data should be.
Me.LabelName.Visible = forms!formName.ListBox = ?

The other form must also be open at the time.
 
B

Bob

Well I've got this far: On my from
lbWarning is the ListBox. and lblWarning is my Label
If there is any data in lbWarning I want lblWarning to be Visible, the >0
was a guess!

Private Sub Form_Open(Cancel As Integer)
If Me.lbWarning > 0 Then
Me.lblWarning.Visible = True
Else
Me.lblWarning.Visible = False
End If

End Sub
 
B

Bob

Fred, I copied the list box on the same form and I will make it not
Visible....Thanks...bob
 
F

fredg

Well I've got this far: On my from
lbWarning is the ListBox. and lblWarning is my Label
If there is any data in lbWarning I want lblWarning to be Visible, the >0
was a guess!

Private Sub Form_Open(Cancel As Integer)
If Me.lbWarning > 0 Then
Me.lblWarning.Visible = True
Else
Me.lblWarning.Visible = False
End If

End Sub

When you say "any data in lbWarning " do you mean a value in the list
box has been selected?

Me!lblWarning.Visible = Not IsNull(Me![lbWarning])

Place the above code in the Form's Current event as well as in the
lbWarning AfterUpdate event. You do not need it in the Form's Open
event.
 
B

Bob

Thanks Got it ;-))).........Bob

Private Sub Form_Current()
If Me.lbWarning = "SomeValue" Then
Me.lblWarning.Visible = False
Else
Me.lblWarning.Visible = True
End If

End Sub
 
B

Bob

Oops I can get lblWarning to disappear but I cant get it Visible
again...Thanks Bob
Yes fred any text in my listbox

fredg said:
Well I've got this far: On my from
lbWarning is the ListBox. and lblWarning is my Label
If there is any data in lbWarning I want lblWarning to be Visible, the >0
was a guess!

Private Sub Form_Open(Cancel As Integer)
If Me.lbWarning > 0 Then
Me.lblWarning.Visible = True
Else
Me.lblWarning.Visible = False
End If

End Sub

When you say "any data in lbWarning " do you mean a value in the list
box has been selected?

Me!lblWarning.Visible = Not IsNull(Me![lbWarning])

Place the above code in the Form's Current event as well as in the
lbWarning AfterUpdate event. You do not need it in the Form's Open
event.
 
B

Bob

This Code gets both to go Invisible but I cant seem to get them back to
Visible...Thanks bob
If IsNull(Me.lbWarning) Then
Me.lbWarning.Visible = False
Else
Me.lbWarning.Visible = True
End If
If IsNull(Me.lbWarning) Then
Me.lblWarning.Visible = False
Else
Me.lblWarning.Visible = True
End If
 

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