Results 1 to 2 of 2
  1. #1
    access is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    28

    How to check textbox field length dynamically

    Hi All,



    I'm new to MS Access forms. I have a combobox with 3 fields A, B, C. and a textbox. When the option B is selected the length of the characters in textbox should not exceed 3. I'm trying to write VBA code for this as below

    Private Sub TEXTBOX_KeyPress(KeyAscii As Integer)
    If [TEXTBOX].length && [COMBOBOX] = "B" Then
    MsgBox "Error"
    End Sub

    But the "length" field is not available in TEXTBOX, Could any one of you please let me know on how to resolve this.

    Thanks you.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If Len(Me.TextBox.Text) > 3 AND Me.ComboBox = "B" Then

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

Similar Threads

  1. Replies: 0
    Last Post: 01-08-2009, 05:49 PM
  2. Automatic field check and population
    By danidin in forum Forms
    Replies: 0
    Last Post: 01-03-2009, 12:45 PM
  3. Trying to check a remote connection!
    By Zermoth in forum Programming
    Replies: 1
    Last Post: 12-11-2008, 05:15 AM
  4. Check Box issues
    By data123 in forum Forms
    Replies: 0
    Last Post: 01-03-2007, 03:21 PM
  5. check boxes
    By chiefmsb in forum Forms
    Replies: 1
    Last Post: 11-14-2006, 02:22 PM

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