Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Formatting a Dummy field

Posted on 2016-08-22
9
Medium Priority
?
83 Views
Last Modified: 2016-08-23
Experts,

I have a union query with a dummy field ("" as AmountDummy in the SELECT statement)
This dummy field doesnt conditionally format in my report. (ie the conditional formatting for <0 and turn text red) and the negative sign on the number doesnt go away on any format I apply.  The following is the format I have in the control source on the report:
=Format([AmountDummy],"(#,##0.00)")
and it appears like this: -(25.50) - note the negative sign.

How do I format this field red for a negative number and get rid of the "-" sign and use parenthesis for negatives?

thank you
0
Comment
Question by:pdvsa
[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
9 Comments
 
LVL 58
ID: 41765743
You pass multiple formats....1st is positive #'s, 2nd negative, 3rd zero, and 4th null, so:

#,##0.00;(#,##0.00)[Red];"Zero";"Null"

Jim
0
 

Author Comment

by:pdvsa
ID: 41765770
Ok I think I got that but have a follow up.  

It turns the text red, which is what I want but it doesnt remove the "-" sign and there are no parenthesis.  I put the format in the formatting in the space below the control source in the properties sheet.

what do you think is the issue?
0
 
LVL 58
ID: 41765819
Hum, works fine here.   I opened the VBA editor and the debug window (Ctrl/G) and typed in:

? Format(-123.45,"#,##0.00;(#,##0.00)[Red]")

and got

(123.45)

Jim.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:pdvsa
ID: 41765840
I think this field is a little different since its a dummy field but maybe i should drag the field into the rpt again and test.  Possibly the field has an odd format format since I have been made a few changes to the field.  Will try when i wake up in a few hours because im not in the us now and not in front of computer.
0
 

Author Comment

by:pdvsa
ID: 41766275
Hi Jim,

Ok back at the computer.  I dragged in a new [AmountDummy] field and applied the format #,##0.00;(#,##0.00)[Red];"Zero";"Null"  as described above but there is no format applied to the field.  

I mentioned in my previous post that the field turns red but after second look it was because of a conditional format I applied (<0 and apply text font color red).

I am sure it is because this field is not a "normal" field like the others because it is dummy.  the  formatting #,##0.00;(#,##0.00)[Red];"Zero";"Null" works on other fields.

the record source is a union if that makes a difference.  thank you.  If you have any other ideas let me know.  

thank you
0
 
LVL 39

Expert Comment

by:PatHartman
ID: 41766323
I'm confused.  If the value of the dummy field is "" which is a zero length string, what is there to format?  If you want it to be zero, make the value zero rather than "".
0
 
LVL 51

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 41766575
I have a union query with a dummy field ("" as AmountDummy in the SELECT statement)
I believe that is your issue. With "" as the dummy value, the values from other sections of the union query also turn into string, thus your output is strings, not numbers.

Try changing the dummy value to Null.
Or you may have to use the union query as source in a new select query. In this you convert your strings to numbers (currency) which you can format as you intend.

/gustav
0
 
LVL 58
ID: 41766727
<<I mentioned in my previous post that the field turns red but after second look it was because of a conditional format I applied (<0 and apply text font color red).>>

  Did you remove the conditional format then?

  and as gustav said, the data type must be correct (numeric)

Jim.
0
 

Author Closing Comment

by:pdvsa
ID: 41767426
Thank you Gustav.  This is what it was...
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

730 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