Public Function GetStrOccurrences(strSearchFor As String _
, strSearchString As String _
, Optional intCompare = vbTextCompare) As Integer
'Source: datAdrenaline
'
http://www.utteraccess.com/forums/showflat.php? _
' Cat=&Number=1833584&page=&view=&sb=&o=&fpart=&vc=
'Searchs through the strSearchString for strSearchFor and returns the number
'of times that strSearchFor occurs
If Len(strSearchFor) > 0 Then _
GetStrOccurrences = UBound(Split(strSearchString, _
strSearchFor, , _
intCompare))
End Function
I came across this a few weeks ago. Might come in handy. Incidentally, the
link has a few other methods, as well as examples of how each one works.
--
Jack Leach
www.tristatemachine.com
"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)