Solved

Surround number with parentheses if condition exists

Posted on 2014-12-20
2
87 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
2 Comments
 
LVL 119

Accepted Solution

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

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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Correct ordering 16 48
Sum Max help (Add 1 Month) 3 19
Replace special characters in Access VBA 8 33
Access MDB/PDF 21 32
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now