Words Limit in MS Access TextBox


As you know, there is no words count function for MS Access TexBox.

You can count number of words in Access form Textbox as the following procedure.

Private Sub UserReport_Exit(Cancel As Integer)
Dim NoOfWords As Long
NoOfWords = Len(Trim(Me.UserReport)) - Len(Replace(Me.UserReport, " ", "")) + 1
If NoOfWords > 200 Then
MsgBox "No. of Words=" & NoOfWords & vbCrLf & " 200 Words Max., Please", vbCritical
Cancel = True
End If

End Sub

Download example

Related Posts

No comments:

Post a Comment