Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2007

Tip: Looking for answers? Try searching our database.

How to Set Decimal Places in Format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
doyle60@aol.com - 06 Mar 2007 20:48 GMT
I have the following in a union query as one of the fields:

   Format(Year1Qrt1MU,"Percent") AS [Qtr 1 %]

How do I get it to return only one decimal instead of two, as seems to
be its want?

Also, I have another field:

   Year1Qrt1EV AS [Qtr 1 Sales]

How do I set it to return in Standard format with no decimal places?

I couldn't find the answer by googling, surprisingly,

Thanks,

Matt
Damian S - 06 Mar 2007 23:49 GMT
Hi Matt,

Format(Year1Qrt1MU,"0.0") & "%" AS [Qtr 1 %]

Damian.

> I have the following in a union query as one of the fields:
>
[quoted text clipped - 14 lines]
>
> Matt
onedaywhen - 07 Mar 2007 15:04 GMT
On Mar 6, 8:48 pm, "doyl...@aol.com" <doyl...@aol.com> wrote:
> I have the following in a union query as one of the fields:
>
>     Format(Year1Qrt1MU,"Percent") AS [Qtr 1 %]
>
> How do I get it to return only onedecimalinstead of two, as seems to
> be its want?

Which rounding algorithm?

SELECT ROUND(0.05, 1)
returns 0 (banker's rounding).

SELECT FORMAT(0.05, '0.0')  ' Arithmetic rounding
retuns '0.1'  (rounds away from zero) .

Jamie.

--
doyle60@aol.com - 07 Mar 2007 16:07 GMT
Onedaywhen, thanks for pointing out the two different ways to round.
Daman S., thanks but perhaps you forgot to multiply by 100.  So, of
course, it is this:

    Format(Year1Qrt1MU*100,"0.0") & "%" AS [Qtr 1 %]

Is there any thing bad about adding the "%" as if a text?  Will I have
problems multiplying by the number in future queries, for example?
Will it still be a number?

The second question was not answered.  I figured out from your above
response to make it this:

    Format(Year1Qrt1EV,"#,#") AS [Qtr 1 Sales]

Is that okay?  It seems to work.

Thanks,

Matt
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.