[AccessD] Limit Text in Field

Gustav Brock Gustav at cactus.dk
Wed Nov 1 08:46:03 CST 2006


Hi Arthur 

Oh, this _is_ a big deal and I'm glad you brought attention to it. An application should be user-friendly.

/gustav

>>> artful at rogers.com 01-11-2006 05:16 >>>
Slick. My only criticism is that it waits for the user to go too far, rather than cautioning the user that he is about to go too far. (I tend toward guiding users to correctness rather than busting them for errors.) Perhaps your code could be modified to write the [length] + " of 255 characters allowed" to the status bar, so the user anticipates the error rather than commits it. 

Not a big deal. I like your solution. One of my mantras is, "Make the user feel like a dancer." That means preclude error to the best of my ability, and then of course deal with it should it occur.

A.

----- Original Message ----
From: John Bartow <john at winhaven.net>
To: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Sent: Tuesday, October 31, 2006 1:12:03 PM
Subject: Re: [AccessD] Limit Text in Field

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