Results 1 to 2 of 2

Thread: [RESOLVED] How to round the number for string data type field name?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] How to round the number for string data type field name?

    I have problem here, I used text data type for all these field name. I don't know how to round these number. I got 3.4189189.. after calculating the value. How I can round these number to be like this 3.412 ?

    Code:
    Fields("Hasil Kasar (kg)").Value = Text2.Text
             Text3.Text = Val(Text2.Text) / 1000 / Label10.Caption
            .Fields("Purata Hasil Kasar (Tan/ha)").Value = Text3.Text
             Text4.Text = Text2.Text - (Text2.Text * 17) / 100
            .Fields("Hasil Bersih (-17 %)").Value = Text4.Text
             Text5.Text = Text3.Text - (Text3.Text * 17) / 100
            .Fields("Purata Hasil Bersih (Tan/ha)").Value = Text5.Text
    Attached Images Attached Images  

  2. #2
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: How to round the number for string data type field name?

    Use Round() function:
    =Round(Val(Text5.Text), 3)
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

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