Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Posts
    173

    Unanswered: formatting numbers

    I am using a MS Access ADP connected to SQL Server Data

    In a view I have the following formula:

    dbo.tblQuoteItem.Cost + dbo.tblQuoteItem.Markup * dbo.tblQuoteItem.Cost * .01

    this calculates cost + markup

    I cannot get it to format in Currency

    Ex:

    Cost is $1.75
    Markup is 2.00 (2%)
    Total shows - 1.785000

    I want $1.78

    Also - I am using this formula to calculate the Quoted price for the Qty Entered

    dbo.tblQuoteItem.Qty * dbo.tblQuoteItem.Cost + dbo.tblQuoteItem.Markup * dbo.tblQuoteItem.Cost * .01

    Using a Qty of 2 for above, I get 3.535000

    I want $3.53


    Any help is appreciated - AB

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    SQL Server does not format output. That is the job of your interface (Access ADP, in this case).

    Set the format of your form control or report field to display as currency.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    you could something like SELECT CAST(3.5553 as decimal(10,2)) but this rounds up (3.56). I would handle this in your VBA with a formatcurrency('your variable here',2).

    This might round too. Or it might just cut off your percision. I forget. Test.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •