Solved

Formatting a Dummy field

Posted on 2016-08-22
9
30 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
9 Comments
 
LVL 57
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 57
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
 

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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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 34

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 49

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

759 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

18 Experts available now in Live!

Get 1:1 Help Now