Results 1 to 6 of 6
  1. #1
    softspoken is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    61

    Limiting fields to certain lengths......

    How can you limit fields to certain lengths. For example I have a policy number field that is 10 characters long. I need for it to give an error message or something if they dont key in at least 10 numbers.

    Can anyone help?



    Thanks

    (Access 2003)

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    I want to Limit the length of a Fiel to 10 characters. this can be done in the following ways:
    Name of my Field is SS

    In the Table design sel Validation Rule to:
    Len([SS])=10
    Or if you want the validation to be done in the form.
    Go to the Properties of the Text Box and in Data section in Validation Rule Type:
    Len([SS])=10

    In Both cases type the message you want to prompt in the Validation Text.

    or You can include this code below in the BeforeUpdate Event of the Field in the Form:

    Private Sub ss_BeforeUpdate(Cancel As Integer)
    Dim intLenght As Integer
    intLength = Len(Me.ss)
    Select Case intLenght
    Case Is <> 10
    MsgBox "Minimum 10 Characters"
    Cancel = True
    End Select
    End Sub

    Remember to substitute SS with the name of your Field.
    This are a few ways if this solves your problem mark the thread solved.

  3. #3
    softspoken is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    61
    worked perfectly thank you

  4. #4
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    please mark this thread solved!!!!!!!!!!! This will help some one with the same problem get assured answers.

  5. #5
    softspoken is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    61
    Quote Originally Posted by maximus View Post
    please mark this thread solved!!!!!!!!!!! This will help some one with the same problem get assured answers.
    To be honest i dont know where to do that. i thought i did but its not where i thought it was ... sorry

  6. #6
    softspoken is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    61
    found it sorry

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 03-20-2010, 08:30 AM
  2. Replies: 3
    Last Post: 08-10-2009, 08:33 AM
  3. Limiting access to certain users only
    By huskies in forum Security
    Replies: 1
    Last Post: 04-01-2009, 08:18 AM
  4. Limiting access to a Form
    By huskies in forum Forms
    Replies: 0
    Last Post: 12-02-2008, 09:21 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