Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

length of text on datagrid

Status
Not open for further replies.

Casiopea

Programmer
Jan 15, 2003
47
0
0
ES
I don't know how to control the length of the text inside a column. I want to know the length of the text inserted/updated on the cell before updating. If the text is greater than 20 characters I want to warn the user. Right now instead of that, the application send an error (because sometimes the length is greater than the length of the column defined on the field of the table) and don't let me update it or cancel the update event.

The datagrid has allowNew, alloUpdate set to true.
 
Hi!

Private Sub Text1_Change()
If Len(Text1.Text) > 5 Then
Text1.SelStart = 5
Text1.SelLength = 1
Text1.SelText = ""
MsgBox "dsf"
End If
End Sub

I hope this helps you...
 
Thank you for that answer, but the problem is the datagrid cell length. That cell shows the content of a field in a recordset. If the user wants to change it, I want to control that the length is not greater than the field size.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top