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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show negative balance as red text on form 1

Status
Not open for further replies.

jazminecat

Programmer
Jun 2, 2003
289
US
Hi, I have data that is being imported from an excel file, which is in turn dumped from our as400. Each record in my table has a balance, and negative balances are formatted as ($1.00), with positive numbers just not having the parentheses.

My form is based on a query that sums all the balances for each person, and returns a total. That total is sometimes a negative number, displayed again as ($1.00). I would like the negative numbers to be red on my form that displays the data. so if the field contains a paren, make it red. Thei field is formatted as Currency in the table.

Anyone know how to do this? I've tried:

If SumOfBalance.Text Like "(" Then
SumOfBalance.ForeColor = red
Else: SumOfBalance.ForeColor = black
End If

which does nothing.

If SumOfBalance < 0 Then
SumOfBalance.ForeColor = red
Else: SumOfBalance.ForeColor = black
End If

which also does nothing.

thanks in advance
 
A bit simplistic with no coding but have you tried this approach:

In the design view - highlight your text and next go to Format menu and select Conditional formatting. From there it should be rather intuitive to format this control to show as red on a negative value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top