Fortmatting  a Percenatge in a text box

Posted on 2013-01-14
Last Modified: 2013-02-15
I have the code below that when it calculates I get  a value of


 I need it to be 21.44%.

How do I get it to format with out messing up the calculation? The calcution does this:
1. Counts the number that is 100 percent done
2. then it sums  the percentage that is not 100% done
3. Totals those together (gives you 25.3)
4.then it divides that answer by 1.18

Here is the code:
=(DCount("[Percentage]","qrytemplePercentage"," [Unit ]= ('2-1AD')AND Percentage IN('100') ")+Nz(DSum("[Percentage]","qrytemplePercentage"," [Percentage ] NOT IN ('100') AND Unit =('2-1AD')" & " AND " & " Not IsNull (InShopDate)")/100))/1.18 & "%"
Question by:gigifarrow
LVL 33

Assisted Solution

Norie earned 125 total points
ID: 38775602
Use Format.
=Format((DCount("[Percentage]","qrytemplePercentage"," [Unit ]= ('2-1AD')AND Percentage IN('100') ")+Nz(DSum("[Percentage]","qrytemplePercentage"," [Percentage ] NOT IN ('100') AND Unit =('2-1AD')" & " AND " & " Not IsNull (InShopDate)")/100))/1.18, "#.00%")

Open in new window

LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 125 total points
ID: 38775607
returns 21.44%

So, in a text box:


Assisted Solution

shorvath earned 125 total points
ID: 38775616
= Format(DCount("[Percentage]","qrytemplePercentage"," [Unit ]= ('2-1AD')AND Percentage IN('100') ")+Nz(DSum("[Percentage]","qrytemplePercentage"," [Percentage ] NOT IN ('100') AND Unit =('2-1AD')" & " AND " & " Not IsNull (InShopDate)")/100))/1.18, "0.##") & "%"

Accepted Solution

rossdalangin earned 125 total points
ID: 38803890
Use the round function like:

output is 21.44

=round((DCount("[Percentage]","qrytemplePercentage"," [Unit ]= ('2-1AD')AND Percentage IN('100') ")+Nz(DSum("[Percentage]","qrytemplePercentage"," [Percentage ] NOT IN ('100') AND Unit =('2-1AD')" & " AND " & " Not IsNull (InShopDate)")/100))/1.18,2) & "%"
LVL 46

Expert Comment

by:Martin Liss
ID: 38895150
I've requested that this question be closed as follows:

Accepted answer: 168 points for imnorie's comment #a38775602
Assisted answer: 166 points for shorvath's comment #a38775616
Assisted answer: 166 points for DatabaseMX's comment #a38775607

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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 …

808 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