My Assistant
![]() ![]() |
|
|
Jan 12 2012, 02:29 PM
Post
#1
|
|
|
UtterAccess Ruler Posts: 4,238 From: Downey, CA |
I should know this (IMG:style_emoticons/default/confused.gif) I just ran a query with dollar amounts, grouped by 3 regions - came out like this:
West ........... 301098.7500000001 East............. 2769520.85 South........... 722571.22 In the syntax of my query, how do I add the word Format and get xxx,xxx - commas separting thousands, no decimels - I know I can accomplish this by going into the design grid and right clicking, then going into format, but I want to save that step CODE SELECT DISTINCT Areas.AreaID, Areas.AreaName, Sum(2011_REVENUE.NetRevenue) AS SumOfNetRevenue
FROM ((2011_REVENUE INNER JOIN (Areas INNER JOIN Agents ON Areas.AreaID = Agents.AreaID) ON (2011_REVENUE.AGENT = Agents.agent) AND (2011_REVENUE.PRIN = Agents.prin) AND (2011_REVENUE.SYS = Agents.sys)) INNER JOIN (ServiceCodes LEFT JOIN Accounts ON ServiceCodes.AcctNumID = Accounts.AcctNumID) ON (2011_REVENUE.SC_Desc = ServiceCodes.SC_Desc) AND (2011_REVENUE.ServiceCode = ServiceCodes.ServiceCode)) LEFT JOIN ServiceType ON 2011_REVENUE.NATURE_OF_SERV_GLS = ServiceType.ServeTypeID GROUP BY ServiceCodes.Phone, Areas.AreaID, Areas.AreaName HAVING (((ServiceCodes.Phone)=True) AND ((Areas.AreaID) In (65,95,108)) AND ((Sum(2011_REVENUE.NetRevenue))<>0)); |
|
|
|
Jan 12 2012, 02:34 PM
Post
#2
|
|
|
Access Wiki and Forums Moderator Posts: 48,113 From: SoCal, USA |
Hi,
Try something like: SELECT ..., Format(Sum(2011_REVENUE.NetRevenue), "\$#,000") AS SumOfNetRevenue FROM... (untested) Just my 2 cents... (IMG:style_emoticons/default/2cents.gif) |
|
|
|
Jan 12 2012, 04:04 PM
Post
#3
|
|
|
UtterAccess Ruler Posts: 4,238 From: Downey, CA |
SELECT ..., Format(Sum(2011_REVENUE.NetRevenue), "\$#,000") AS SumOfNetRevenue FROM... (untested) Thanks ! There was a typo - the backslash - but got rid of that and it worked great ! (IMG:style_emoticons/default/cool.gif) Steve |
|
|
|
Jan 12 2012, 04:52 PM
Post
#4
|
|
|
Access Wiki and Forums Moderator Posts: 48,113 From: SoCal, USA |
Hi Steve,
(IMG:style_emoticons/default/yw.gif) Glad to hear you got it to work. Good luck with your project. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 25th May 2013 - 09:28 PM |