Label is Visible if Value is Negative

  • Thread starter Thread starter Gulf Coast Electric
  • Start date Start date
G

Gulf Coast Electric

I have a main form with a sub-form on it that I wish to make a label be
visible only if there is a negative balance.
By that I mean if say the customer pays more than the Invoice amount and is
owed a credit.
The main forms name is TimeCards
The sub-forms name is TimeCardPaymentSub
The text box that contains the balance due is named Balance
The label that I want to be Visible only if the Balance text box show a
negative number ($50.00)
is called Label20
 
Assuming the name of the subform >control< on the main form, is MySfCtl, put
this code in the main form's Current event:

me![MySfCtl].form![Label20].visible = (me![Balance] < 0)

That will make the label visible when the balance is negative, invisible
otherwise.

Note that you do not need the name of the main form >or the subform< in that
code. You only need the name of the main form's subform >control<.

HTH,
TC
 
These are both unbound text boxes that simply add or subtract amounts.
(Balance (Text Box) and (Label) Label20
The Main forms name is TimeCards
The sub-forms name is TimeCardPaymentSub
By default the balance text box shows $0.00



--
-------------------------------------------------------------------------
Thanks for your Help.
TC said:
Assuming the name of the subform >control< on the main form, is MySfCtl, put
this code in the main form's Current event:

me![MySfCtl].form![Label20].visible = (me![Balance] < 0)

That will make the label visible when the balance is negative, invisible
otherwise.

Note that you do not need the name of the main form >or the subform< in that
code. You only need the name of the main form's subform >control<.

HTH,
TC


Gulf Coast Electric said:
I have a main form with a sub-form on it that I wish to make a label be
visible only if there is a negative balance.
By that I mean if say the customer pays more than the Invoice amount and is
owed a credit.
The main forms name is TimeCards
The sub-forms name is TimeCardPaymentSub
The text box that contains the balance due is named Balance
The label that I want to be Visible only if the Balance text box show a
negative number ($50.00)
is called Label20
 
What is your question?

TC


Gulf Coast Electric said:
These are both unbound text boxes that simply add or subtract amounts.
(Balance (Text Box) and (Label) Label20
The Main forms name is TimeCards
The sub-forms name is TimeCardPaymentSub
By default the balance text box shows $0.00



--
-------------------------------------------------------------------------
Thanks for your Help.
TC said:
Assuming the name of the subform >control< on the main form, is MySfCtl, put
this code in the main form's Current event:

me![MySfCtl].form![Label20].visible = (me![Balance] < 0)

That will make the label visible when the balance is negative, invisible
otherwise.

Note that you do not need the name of the main form >or the subform< in that
code. You only need the name of the main form's subform >control<.

HTH,
TC


Gulf Coast Electric said:
I have a main form with a sub-form on it that I wish to make a label be
visible only if there is a negative balance.
By that I mean if say the customer pays more than the Invoice amount
and
is
owed a credit.
The main forms name is TimeCards
The sub-forms name is TimeCardPaymentSub
The text box that contains the balance due is named Balance
The label that I want to be Visible only if the Balance text box show a
negative number ($50.00)
is called Label20




--

-------------------------------------------------------------------------
Thanks for your Help.
 
Back
Top