Results 1 to 7 of 7

Thread: [RESOLVED] Code Help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    99

    Resolved [RESOLVED] Code Help

    Code:
    curtotal = (((curftotal + curstotal + curbtotal) * sngtax) + (curftotal + curstotal + curbtotal))
    i dim curtotal as currency but my finals output is not in currency. it gives me numbers like 12.325 or any number with three or four decimals
    Last edited by Hack; Mar 19th, 2007 at 08:24 AM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark

  2. #2
    Frenzied Member
    Join Date
    Jun 2006
    Posts
    1,098

    Re: Code Help

    The currency data type allows for up to 4 digits to the right of decimal point. If you want only two, then you need to round the result.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    99

    Re: Code Help

    Quote Originally Posted by Logophobic
    The currency data type allows for up to 4 digits to the right of decimal point. If you want only two, then you need to round the result.
    can you show me how to round? would it be like
    curtotal = Round(((curftotal + curstotal + curbtotal) * sngtax) + (curftotal + curstotal + curbtotal)),2

  4. #4

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Code Help

    Another way would be

    vb Code:
    1. curtotal = FormatNumber((((curftotal + curstotal + curbtotal) * sngtax) + (curftotal + curstotal + curbtotal)),2)
    where 2 is the number of decimal places you want.

    BTW it's better to use [highlight=vb][/highlight] tags when posting code. Then to get around the problem with copy/paste of code formatted that way you can use the app you can download from the Copy/Paste VB Code link in my signature.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    99

    Re: Code Help

    [QUOTE=MartinLiss]Another way would be

    vb Code:
    1. curtotal = FormatNumber((((curftotal + curstotal + curbtotal) * sngtax) + (curftotal + curstotal + curbtotal)),2)
    where 2 is the number of decimal places you want.
    QUOTE]


    thanks thats perfect

    Thank you all

  7. #7

Posting Permissions

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



Click Here to Expand Forum to Full Width