Control Visible Conditionally

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a button that I want to be visible if a text box holds a value of less
than -1.
In the form's current event I have the following code but I keep getting an
error of "data mismatch"

Me.BadButton.Visible=Me.Balance<-1

The Balance field is a calculated field that shows the net transaction
amount and is formatted as currency. If a loss of over $1.00 is found, an
explanation must be entered on the form that will be opened by this button.
Any suggestions on how to fix this?
 
I would try using the same calculation that the calculated field
uses in my Form_Current event, store the result in a variable, and
set the BadButton.Visible property based on the value of the
variable.

Max
 
Good idea... however, the calculated field makes it's calculations based on
serveral other calculations and lookups on the results of queries. That would
be quite a lengthy statement.

Is there any other way?
 
David

Try

Me.BadButton.Visible = nz(Me.Balance,0)<-1

I am thinking that you get the error when Me.Balance is Null. Due to the
propagation of Nulls Me.Balance<-1 will return Null whenever Me.Balance is
Null. And Null is not gonna be acceptable to BadButton's visible property
which will only accept True/False.

Ron W
 
Back
Top