Restrict memo field to size of text box

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
 
A

Arvin Meyer [MVP]

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?
 
J

John W. Vinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top