Having all kinds of problems with the code below...
If I run it it gives out maxlocks errors. Ive moved the registry entry to the max but it still gives the error
Public Function NoiseWords(sCompanyName As Variant)
Dim sTestString As String
Dim sTestString2 As String
Dim sReturnString As String
Dim lCounter As Long
Dim NoiseRs As DAO.Recordset
Set NoiseRs = CurrentDb.OpenRecordset("zz_NoiseWord", 2)
sTestString = sCompanyName
sReturnString = sTestString
If Len(sCompanyName) > 0 And InStr(sCompanyName, "PUBLIC LIMITED COMPANY") = 0 Then
sTestString2 = Right(sTestString, Len(sTestString) - InStrRev(sTestString, " "))
lCounter = Len(sTestString)
Do Until lCounter <= 0
NoiseRs.FindFirst "[Noiseword] = """ & sTestString2 & """"
If NoiseRs.NoMatch = True Then
Exit Do
Else
sReturnString = Trim(Left(sTestString, Len(sTestString) - Len(sTestString2)))
End If
sTestString = Trim(Left(sTestString, InStrRev(sTestString, " ")))
lCounter = InStrRev(sTestString, " ")
sTestString2 = Right(sTestString, Len(sTestString) - InStrRev(sTestString, " "))
Loop
NoiseWords = sReturnString
End If
Any help appreciated.
If I run it it gives out maxlocks errors. Ive moved the registry entry to the max but it still gives the error
Public Function NoiseWords(sCompanyName As Variant)
Dim sTestString As String
Dim sTestString2 As String
Dim sReturnString As String
Dim lCounter As Long
Dim NoiseRs As DAO.Recordset
Set NoiseRs = CurrentDb.OpenRecordset("zz_NoiseWord", 2)
sTestString = sCompanyName
sReturnString = sTestString
If Len(sCompanyName) > 0 And InStr(sCompanyName, "PUBLIC LIMITED COMPANY") = 0 Then
sTestString2 = Right(sTestString, Len(sTestString) - InStrRev(sTestString, " "))
lCounter = Len(sTestString)
Do Until lCounter <= 0
NoiseRs.FindFirst "[Noiseword] = """ & sTestString2 & """"
If NoiseRs.NoMatch = True Then
Exit Do
Else
sReturnString = Trim(Left(sTestString, Len(sTestString) - Len(sTestString2)))
End If
sTestString = Trim(Left(sTestString, InStrRev(sTestString, " ")))
lCounter = InStrRev(sTestString, " ")
sTestString2 = Right(sTestString, Len(sTestString) - InStrRev(sTestString, " "))
Loop
NoiseWords = sReturnString
End If
Any help appreciated.