Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking For Negative Numbers 3

Status
Not open for further replies.

FontanaS

Programmer
May 1, 2001
357
US
I have a field in the report that finds the sum of some numbers in a table -

=DSum("[InvoiceAmount]","invoices-new","[AACETaskID] = [Text39] ")

It works fine. Then I subtract it from the main amount to get the balance -

=[FundingLevel]-[Text35]

Now I Would Like To Check And Make The Numbers Red If The Balance Is Negative. How Do I Do That?

Do I Write Code In tHe open Event?

THANKS!

 
Use the On Format Event for the section of the report, Detail or Report / Page Header that the textbox is in, and change the textbox's ForeColor.

If Val(Nz([FundingLevel],0)) - Val(Nz([Text35],0)) < 0 Then
TextboxName.ForeColor = vbRed
Else
TextboxName.ForeColor = vbBlack ' or the normal fore color number
End If

PaulF
 
You might not need code. This is an example format property setting from Access Help:

$#,##0.00[Green];($#,##0.00)[Red];"Zero";"Null"

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top