R
Raines95
This question was posted a few years ago and I am essentially looking for the
same result. I want to pull out keywords and based upon their frequency and
relevance, identify problem trends. The VBA code provided a few years ago by
Ken Sheridan was this:
I am using Access 2007 and when I first used this code, it seemed like it
was stuck in the loop as Access would just sit there forever. Now when I run
it, it returns no values. I have confirmed that there are words meeting the
length I am looking for. Is there something new in Access 2007 that would
require changes to this code?
same result. I want to pull out keywords and based upon their frequency and
relevance, identify problem trends. The VBA code provided a few years ago by
Ken Sheridan was this:
''''Module starts''''
Option Compare Database
Option Explicit
Function GetLongWords(ByVal strText As String, intWordLength As Integer) As
String
Dim intSpacePos As Integer
Dim strWord As String, strWordList As String
intSpacePos = 0
' replace any double spaces with single space
strText = Replace(strText, " ", " ")
' loop through text and identify each word,
' assuming a word is terminated by a space or end of string
Do While True
intSpacePos = InStr(strText, " ")
If intSpacePos > 0 Then
strWord = Left$(strText, intSpacePos - 1)
' remove any punctuation form end of word
strWord = TrimWord(strWord)
If Len(strWord) >= intWordLength Then
' following <If> and <End If> only necessary if you want to
' look words up in Keywords table
If Not IsNull(strWord, "Keywords" Then
strWordList = strWordList & ", " & strWord
End If
End If
' trim word off text
strText = Mid$(strText, intSpacePos + 1)
Else
' word must be last in text so
strWord = TrimWord(strText)
If Len(strWord) >= intWordLength Then
' following <If> and <End If> only necessary if you want to
' look words up in Keywords table
If Not IsNull(strWord, "Keywords" Then
strWordList = strWordList & ", " & strWord
End If
End If
Exit Do
End If
Loop
' remove leading comma and space
GetLongWords = Mid$(strWordList, 3)
End Function
Private Function TrimWord(strWord As String) As String
' remove any punctuation characters from word
Do While True
Select Case Right$(strWord, 1)
Case ".", ",", ";", ":", "?", "!"
strWord = Left$(strWord, Len(strWord) - 1)
Case Else
Exit Do
End Select
Loop
TrimWord = strWord
End Function
''''Module ends''''
I am using Access 2007 and when I first used this code, it seemed like it
was stuck in the loop as Access would just sit there forever. Now when I run
it, it returns no values. I have confirmed that there are words meeting the
length I am looking for. Is there something new in Access 2007 that would
require changes to this code?