[AccessD] Limit Text in Field

Stuart McLachlan stuart at lexacorp.com.pg
Tue Oct 31 09:28:51 CST 2006


On 31 Oct 2006 at 8:45, Hollis, Virginia wrote:

> I tried the ' say your text field is text1, couldn't you put text1 =
> left(text1,500) & it didn't like that - it gives a runtime error about
> the BeforeUpdate can't save the record.
>
> Also, Does anyone have something that shows how many characters have
> been typed (it shows as they type)?

Create another text box Text2 to display the length and then use this:

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Text2 = Len(Text1.Text)
If Len(Text1.Text) > 40 Then
   MsgBox "Too many characters"
   Text1.Text = Left$(Text1.Text, 40)
End If-- 
Stuart





More information about the AccessD mailing list