Solved

Formatting a Dummy field

Posted on 2016-08-22
9
75 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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 38

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 500 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

627 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