Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Surround number with parentheses if condition exists

Posted on 2014-12-20
2
Medium Priority
?
95 Views
Last Modified: 2014-12-22
On a report, if one number is greater than another number then I want the 3rd number to be surrounded by parentheses.

I've tried this in the onformat and onprint event of the report detail section:

If Me.txtActualHrs > Me.txtSchedHrs Then
Me.txtHrVariance = "(" & Me.txtHrVariance & ")"
End If

Open in new window

0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1000 total points
ID: 40510844
try
set the Format property of the textbox to 0.00;(0.00)
0
 
LVL 52

Assisted Solution

by:Gustav Brock
Gustav Brock earned 1000 total points
ID: 40512518
No need for code. Just adjust the ControlSource of txtHrVariance:

=IIf(Me!txtActualHrs > Me!txtSchedHrs, "(" & <yourcurrentcontrolsource> & ")",<yourcurrentcontrolsource>)

So, if <yourcurrentcontrolsource> is [ActualHrs]:

=IIf(Me!txtActualHrs > Me!txtSchedHrs, "(" & [ActualHrs] & ")",[ActualHrs])

/gustav
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question