krap gets it's control source from a sub-form, it just equals whatever is in
the field on the sub-form
=[FPaymentSub].[Form]![Balance] THIS is the control source for the
textbox krap
therefore eliminating referring to the sub-form altogether.
The format for both fields; krap and it's control source are currency
The MAIN form on the current event has a Call Function that uses a module.
Remember the MAIN has (5) sub-forms on it, but I am not using these for the
code now, except to refer to
a sub-form using a textbox with it's control source set to the textbox on
the sub-form.
I tried this code on a plain vanilla form and it works IF
you use -1 or whatever negative number (-2, or -3, etc...) for the value of
krap
<0 does not work.
Because the main form refreshes and calls a module and other (A Lot) of
code, it is sometimes necessary to use a timer event to make it all work.
What is funny is that I have some code which produces a similar result on
the sub-form that works,while the other codes does not.
If IsNull(Balance) Then
Label20.Visible = False
Else
Label20.Visible = (Balance < 0)
End If
Balance is the textbox on the sub-form that is being checked, i.e. krap='s
Balance
John Vinson said:
ALL Labels ARE ON THE MAIN FORM AND FIRE on the CURRENT EVENT
Thank you. That helps.
Note: some code WILL ONLY fire on the current event if there is a delay,
i.e. Timer Event
I have *NEVER* experienced this.
This comes form a lot of experience on my part, that is why I tried the
code
this way!
I know this for a fact because of seeing it work and not work. Also some
code has to be moved up in the
order of code events to fire. Have been experimenting with these to no
success so far.
If the value of krap is below zero, then Label423 should be visible, else
not visible.
What is the Control Source of [krap]? What is the Recordsource of the
Form?
I would REALLY expect:
Private Sub Form_Current()
If Val(Me![krap]) < 0 Then
Me!Label423.Visible = True
Else
Me!Label423.Visible = False
End If
End Sub
or even
Me!Label423.Visible = (Me![krap] < 0)
to work perfectly, unless krap is being populated by some VBA code
operation that you haven't mentioned. If it's a bound field, bound to
a numeric table field, then I'm baffled as to why either of the above
should fail.
John W. Vinson[MVP]