Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    WhatnThe is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    50

    12 Zeros past decimal


    How do you limit the number of zeros that are displayed past the decimal point? Right now we are 12 out from the decimal

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Forms allow you to control what is displayed.

  3. #3
    WhatnThe is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    50

    Limit decimal

    How do you limit the number of zeros that are displayed past the decimal point? Right now we are 12 zeros past the decimal

  4. #4
    WhatnThe is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    50
    The calculation are taking place within my form. The issue is that even after setting the the decimal places to 3 in the property sheet we still get a value that looks like this: 2.568975545545151

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The property sheet of the control that displays the value?

  6. #6
    WhatnThe is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    50
    I am not sure what you mean.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What property sheet? How are you doing the calculation?

  8. #8
    WhatnThe is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    50
    It would be easier to show you. I am going to upload a 2003 demo to you can view it.

    To see that I am talking about first select a part number from the drop down list, then add a value to the Lengths field, then look at the StaHrs field. you will see if you select 31150 part number then enter 1000 in the Lengths field
    you that StaHrs has a value of 34.9099099099099. I want to see something like 34.909

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Use the Round() function or Format() function to control the output of the calculation. The Format properties of controls only work on the data in fields bound to the control.

  10. #10
    WhatnThe is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    50
    So, would I need to add the format value to the current vb code to get the format I am looking for?

    If I added this
    Code:
    Me!HrsErnd.Format = "Fixed"
    to this

    Code:
    Sub CalcProduced1()
    
       If Not IsNull(Me.NumberOfMachine) And Not IsNull(Me.HrsErnd) Then
          Me.HrsErnd = 480 / Me.NumberOfMachine / 60
          Me!HrsErnd.Format = "Fixed" <<<< Correct?>>>>>
    
       Else
          Me.HrsErnd = ""
       End If
    
    End Sub
    would I get the format I am looking for?

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Nope! You need something like:
    Me.HrsErnd = Round(480 / Me.NumberOfMachine / 60, 3)

  12. #12
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows XP Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Go to your design view of the form.

    Open Properties Box.

    Click on the Text Box in question.

    Go to the Format Tab.

    I think it is somewhere near the top. "Decimal Places" Set the value there.

    Warning............... If you do calculations on this value it might not give the exact result you were hoping for. e.g.

    1.004 + 1.004 = 2.1

    But if you were showing

    1.00 + 1.00 you would expect 2.00

    Trust you understand. If not post back.

  13. #13
    WhatnThe is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    50
    Sorry this was a double post. You answered my question in the other post

  14. #14
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows XP Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    StaHrs is of Data Type Text.

    Why is it so.

    Make it a number. I would suggest Field size of Decimal

  15. #15
    WhatnThe is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    50
    I have tried to change it from text to a number from within the dataentry table but that caused the calculation to quit working. Could I have done it wrong?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Getting rid of zeros
    By ceb39 in forum Reports
    Replies: 26
    Last Post: 05-31-2009, 12:49 PM
  2. leading 'Zeros' in data
    By wasim_sono in forum Forms
    Replies: 3
    Last Post: 04-06-2009, 11:57 AM
  3. Viewing ending zeros in decimal
    By duecesup in forum Reports
    Replies: 0
    Last Post: 12-11-2008, 02:45 PM
  4. Non programer needs help in decimal numbers
    By Peter O in forum Access
    Replies: 1
    Last Post: 10-07-2008, 12:29 PM
  5. Date Past Function
    By Laney in forum Access
    Replies: 4
    Last Post: 05-21-2008, 07:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums