Make Label Visible or Invisible

D

Dave Elliott

The form referred to below is on a sub-form on a main form
The code is being run on the sub-forms current event
Code is not doing anything ???
Tyring to make the Label LblPrtInv visible or invisible if a value is in
the control SentVia



If IsNull ("Forms!FTimeBillingSub!SentVia") Then
Forms!FTimeBillingSub!LblPrtInv.Enabled = False
End If
If Not IsNull ("Forms!FTimeBillingSub!SentVia") Then
Forms!FTimeBillingSub!LblPrtInv.Enabled = True
End If
 
S

Steve Schapel

Dave,

First of all, the ""s around the Forms!FTimeBillingSub!SentVia are not
applicable. But in any case, do you mean that FTimeBillingSub is a
subform? Therefore, it is not open as a form, but only displayed
through the subform control on the main form, so any reference to
Forms!FTimeBillingSub will not have the result you want anyway. You
would need to refer to it like this...
Forms!NameOfMainForm!FTimeBillingSub.Form!SentVia
However, I think you mean that the FTimeBillingSub subform is where the
Current event code is being called from. Right? So in that case the
Forms! reference is not necessary. Therefore, you could so it like this...

If IsNull(Me.SentVia) Then
Me.LblPrtInv.Enabled = False
Else
Me.LblPrtInv.Enabled = True
End If

However, this is neater...
Me.LblPrtInv.Enabled = Not IsNull(Me.SentVia)
 
D

DebbieG

If everything is happening within the subform then you might try this:

If IsNull (Me.SentVia) Then
Me.LblPrtInv.Visible = False
ElseIf Not IsNull (Me.SentVia) Then
Me.LblPrtInv.Visible = True
End If

You stated you wanted to make the label visible or invisible but you have enabled in your code.

What is SentVia ... text, numeric, date?

If that doesn't work you might try putting this in the SentVia AfterUpdate event. Depends on when you want it to happen.

HTH,
Debbie


| The form referred to below is on a sub-form on a main form
| The code is being run on the sub-forms current event
| Code is not doing anything ???
| Tyring to make the Label LblPrtInv visible or invisible if a value is in
| the control SentVia
|
|
|
| If IsNull ("Forms!FTimeBillingSub!SentVia") Then
| Forms!FTimeBillingSub!LblPrtInv.Enabled = False
| End If
| If Not IsNull ("Forms!FTimeBillingSub!SentVia") Then
| Forms!FTimeBillingSub!LblPrtInv.Enabled = 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