Du kunne opsplitte linjen i felter med hver sit ord:
Public Function WordSplit( _
ByVal Line As String, _
ByVal Index As Integer) _
As String
Dim Parts() As String
Dim Value As String
Dim Numbers() As String
Dim NumberIndex As Integer
Dim PartIndex As Integer
Parts = Split(Line)
For PartIndex = LBound(Parts) To UBound(Parts)
If Parts(PartIndex) <> "" Then
NumberIndex = NumberIndex + 1
ReDim Preserve Numbers(0 To NumberIndex)
Numbers(NumberIndex) = LTrim(Numbers(NumberIndex) & " ") & Parts(PartIndex)
End If
Next
If Index = -1 Then
' Return count of fields (as text).
Value = CStr(UBound(Numbers))
ElseIf Index <= UBound(Numbers) Then
' Return value of a field.
Value = Trim(Numbers(Index))
End If
WordSplit = Value
End Function
og bruge denne i en forespørgsel:
Select
Id,
WordSplit([Felt1], 1) As Word1,
WordSplit([Felt1], 2) As Word2,
WordSplit([Felt1], 3) As Word3,
WordSplit([Felt1], 4) As Word4,
WordSplit([Felt1], 5) As Word5
From
Tabel1
- eventuelt skrive resultatet til en midlertidig tabel.
Herefter kan du filtrere eller joine denne med Tabel2 med søgeordene.