Haitham
11-15-2002, 11:36 AM
Dear There,
I have a table with memo field wich contain hug duplicate text,
i need code to search the word that i specify in inputbox in each and every that memo field and goto next record and count it also.
Thanx in Advance
Travis
11-15-2002, 01:39 PM
Public Function NumInstances() as Long
Dim rst as ADODB.RecordSet
Dim arData as Variant
stSplit=InputBox("Enter the Search String")
Set rst = New ADODB.RecordSet
rst.Open "Select * from [tblName]",CurrentProject.Connection,,adOpenStatic,adLockRea dOnly
If rst.RecordCount>0 then
rst.MoveFirst
Do While Not rst.EOF
arData=Split(rst.Fields("MEMOFIELDNAME"),stSplit)
lCount=lCount+ubound(arData)
rst.MoveNext
Loop
End If
MsgBox "Number of Instances of " & stSplit & ": " & lCount
NumInstances=lCount
End Function
Haitham
11-15-2002, 06:40 PM
Dear Travis,
The Resault Gives Me The MsgBox With Out The Number Of Count Just " Number Of Instances Of MyWord:"
Thanks In Advance
Haitham
Haitham
11-15-2002, 06:47 PM
Thank You,
Public Function NumInstances() As Long
Dim arData As Variant
stSplit = InputBox("Enter the Search String")
Set rs = CurrentDb.OpenRecordset("Select * from [Sheet2]")
If rs.RecordCount > 0 Then
rs.MoveFirst
Do While Not rs.EOF
arData = Split(rs.Fields("Aaya"), stSplit)
lCount = lCount + UBound(arData)
rs.MoveNext
Loop
End If
MsgBox "Number of Instances of " & stSplit & ": " & lCount
NumInstances = lCount
End Function
Thank you alot
Haitham
Haitham
11-15-2002, 06:56 PM
Dear Travis,
But That Is Counting For The Like InputBox Not =, What about if i want to count for exact full word
Thanks
Travis
11-17-2002, 08:05 PM
Add a Space to your text at the end.