Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2003

    Unanswered: Set Form control length

    I have a Form with an unbound Text control. I would like to limit the data entry to 5 characters as when I move the Control to the database field I wind up with an Error Message if the field is larger than the field defined in my Table . I have tried using CCCCC;;" " as the input mask, which works except when using the DELETE key, a BLANK remains and the rest of the entered characters are not shifted.
    eg. Entered: TESST .... use DELETE key .... TES T (space remains)
    Is there another way to accomplish this or do I need to test the length of the field via code?

  2. #2
    Join Date
    Feb 2002
    I think I would test in code in the before update event of the form.

    if Len(Me.txt5)<5 then

    MsgBox "Please enter 5 characters"


    Exit Sub

    End if

    You could also test for numeric although this requires a bit more thought.

Posting Permissions

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