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
Solved

Surround number with parentheses if condition exists

Posted on 2014-12-20
2
90 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 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 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

839 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