Label is Visible if Value is Negative

  • Thread starter Gulf Coast Electric
  • 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
 
T

TC

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
 
G

Gulf Coast Electric

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
 
T

TC

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.
 

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