[AccessD] Limit Text in Field

John Bartow john at winhaven.net
Tue Oct 31 12:12:03 CST 2006


Hi Virginia,

FWIW, here's the on change event procedure that I use with a fax form on
which the "regarding" line field (Text 255) is not long enough for a huge
description but the txtMessage field (Memo) is:

Private Sub txtRegarding_Change()
   'Comment: prevents user form adding too much text to the regarding line
   
   On Error GoTo Form_Open_ERR
   
   If Len(Me.txtRegarding.Text) > 255 Then
      MsgBox "The regarding line can only contain 255 characters, " & _
      "please use the message box for longer text."
      Me.txtRegarding.Text = Left(Me.txtRegarding.Text, 255)
   End If

Form_Open_EXIT:
   Exit Sub
   
Form_Open_ERR:
    MsgBox Err.Description
    Resume Form_Open_EXIT
    
End Sub

HTH
John B.




More information about the AccessD mailing list