Calculating percent complete in a query in Access

Calculating percent complete in a query in Access:

Please see below what the percentages should be under "PN_COMPLETE_PERCENTAGE"

PN                           SumOfQTY_ORD       SumOfQTY_OPEN       PN_COMPLETE_PERCENTAGE
37TB10F                          65                                  65                                                 0%
37TB12F                          12                                    0                                                 100%
37TB16F                          55                                  55                                                 0%
37TB4F                          65                                  62                                                 5%
38TB4F                            4                                    0                                                 100%
38TB6F                          52                                    0                                                 100%
39TB10                         119                                   109                                                 8%
39TB12F                          100                                   90                                                 10%
39TB8F                          20                                    15                                                 25%

I would like the Sql Statement below to get me the results above.

SELECT Trim([PART_NUMBER]) AS PN, Sum(tbl_PART.QTY_ORD) AS SumOfQTY_ORD, Sum(tbl_PART.QTY_OPEN) AS SumOfQTY_OPEN
FROM tbl_PART
GROUP BY Trim([PART_NUMBER]);
LUIS FREUNDAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PatHartmanCommented:
IIf(Nz(SumOfQTU_ORD,0) = 0, 0, 1 - (SumOfQTY_OPEN / SumOfQTY_ORD))
0
LUIS FREUNDAuthor Commented:
Works great....is there a way to format it as such:  100%, 0%, 92% for example?
0
PatHartmanCommented:
Just nest it again:

Format(IIf(Nz(SumOfQTU_ORD,0) = 0, 0, 1 - (SumOfQTY_OPEN / SumOfQTY_ORD)), "percent")

If that isn't valid, just look up the options for Format().  I'm not at my computer.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LUIS FREUNDAuthor Commented:
AWESOME!  Thank you very much!
0
PatHartmanCommented:
you're welcome :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.