Label Visible If $2500.00 or More

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

I need to make a label visible if a textbox amount is $2500.00 or more.
The Lable is named Label354
The textbox is named Commission
I want the (label354) to be visible if the textbox (Commission) amount
equals $2500.00 or more.
The format of the textbox is currency

I tried this, but it showed up all the time after the criteria was met

If Commission >= 2500# Then
Label354.Visible = True
End If
 
Dave Elliott said:
I need to make a label visible if a textbox amount is $2500.00 or
more. The Lable is named Label354
The textbox is named Commission
I want the (label354) to be visible if the textbox (Commission) amount
equals $2500.00 or more.
The format of the textbox is currency

I tried this, but it showed up all the time after the criteria was met

If Commission >= 2500# Then
Label354.Visible = True
End If

There's nothing there to turn the visibility off again. If that code
*almost* works, then this code probably will:

Label354.Visible = (Commission >= 2500#)

Although, if the commission amount is currency, I'd expect that to be

Label354.Visible = (Commission >= 2500@)
 
I need to make a label visible if a textbox amount is $2500.00 or more.
The Lable is named Label354
The textbox is named Commission
I want the (label354) to be visible if the textbox (Commission) amount
equals $2500.00 or more.
The format of the textbox is currency

I tried this, but it showed up all the time after the criteria was met

If Commission >= 2500# Then
Label354.Visible = True
End If

What's with the # sign?
Where are you putting this code?
Once you make the control visible, you must also code to make it not
visible if the criteria is not met.

In the form's Current event....
Using your If .. Then method:

If Commission >= 2500 Then
Label354.Visible = True
Else
Label354.Visible = False
End If

You might want to try this simpler line of code, which is equivalent
to your 5 lines:

Label354.Visible = ([Commission] >= 2500)

If the [Commission] field is user changeable also place the same code
in the [Commission] AfterUpdate event.
 
You were close, but you never set the visible property back to false when
required. Try:

Me![Label354].visible = (me![Commission] > 2500)

If a control is referenced in code, you should really give it a meaningful
name. That makes your code more self-documenting, & easier for you & others
to understand. So perhaps rename your label control to lblComissionMessage,
or somesuch.

HTH,
TC
 
Back
Top