Restrict memo field to size of text box

  • Thread starter Thread starter Phillip
  • Start date Start date
P

Phillip

Hi,
I have a form with a text box that gets data from a memo field in a table.
As the user enters data in the text box I want the input to be restricted to
the size of the text box. Right now as the user types, once the box is full
the data scrolls up. Is there a way to make input stop once the box is full?
Thanks in advance,
Phil
 
Without a fixed width font like Courier New, you really can't easily tell
when the textbox is full. If you use a fixed font, you might try something
like this (aircode):

Private Sub txtMyMemo_Change()

' 150 or whatever the number of characters you want
If Len(Me.txtMyMemo) >= 150 Then
MsgBox "Too many characters" vbOKOnly
End If
End Sub

My question to you is, if you want to limit the number of characters, why
not use a text field instead of a memo field?
 
I want the input to be restricted to
the size of the text box

Ummmm...

Why?

If there's a scrollbar on the textbox they can see it all.
If you're printing a Report you can set the textbox's Can Grow property to
show all the data.
 
Back
Top