Solved

Surround number with parentheses if condition exists

Posted on 2014-12-20
2
91 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 250 total points
ID: 40510844
try
set the Format property of the textbox to 0.00;(0.00)
0
 
LVL 50

Assisted Solution

by:Gustav Brock
Gustav Brock earned 250 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

749 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