Results 1 to 2 of 2

Thread: [RESOLVED] Limit Textbox To 3 Decimal Places

  1. #1

    Thread Starter
    Fanatic Member cid's Avatar
    Join Date
    Nov 2002
    Location
    Fort Worth, Texas
    Posts
    854

    Resolved [RESOLVED] Limit Textbox To 3 Decimal Places

    I need the user to be limited to only three places after the decimal.

    I tried the following, but they all failed:

    FormatNumber([NetAcres], 3) *Doesnt work because a user can not enter 3,001.22 due to precision errors.

    I set the textbox properties to 3 decimals. *Doesn't work because the user can still enter as many decimal places as they want

    I set the field properties to 3 decimals. *Doesn't work because the user can still enter as many decimal places as they want

    www.google.com - Pay Tribute.

    Always Listening To: Thrice

  2. #2

    Thread Starter
    Fanatic Member cid's Avatar
    Join Date
    Nov 2002
    Location
    Fort Worth, Texas
    Posts
    854

    Resolved Re: Limit Textbox To 3 Decimal Places

    Resolved:

    In design view of my table, I setup a validation rule for my field.
    Round([Field],3)

    Then I replaced the default error message with this, in my actual form.

    Code:
    Private Sub Form_Error(DataErr As Integer, Response As Integer)
    Select Case DataErr
           Case 3317
            MsgBox "This field is limited to three decimal places."
        Case Else
            
    End Select
    Response = acDataErrContinue
    End Sub
    I setup a case statement, in the event i ever need to append another response.

    www.google.com - Pay Tribute.

    Always Listening To: Thrice

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