Simple Software Solutions
This depends on where you want to use it.
If you are simply using it to display on the form underneath a large textbox for example then you would use it on the say the got focus/lost focus of a textbox to pass the information to a label.
EG:
Me.LabelInfo = CountWords(Me.TextBox)
Where CountWords is a Function Created as follows:
Public Function CountWords(AnyString As String) As String
Dim WordCount As Integer
For x = 1 to Len(AnyString)
If Mid(AnyString,x,1) = " " Then
WordCound = WordCount + 1
Endif
Next
CountWords = CStr(WordCount) & " word(s)"
End Function
OR:
If you wanted the user to click on a button to find out the number of words in a textbox then on the OnClick of the button
MsgBox "There are " & Countwords(Me.TextBox) & " in this field."
OR:
If you wanted to use it a query the one of your columns would be
Words:Countwords([FieldName])
As long as you refer to the function correctly you should be able to use it anywhere.
CodeMaster:
