?
Solved

Surround number with parentheses if condition exists

Posted on 2014-12-20
2
Medium Priority
?
94 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 51

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

801 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