My attempted sql is
Code:
SELECT tblData2.Prefix, tblData2.LineNum, tblData2.Year, tblComments.comment, tblComments.Address
FROM tblData2 LEFT JOIN tblComments ON tblData2.LineNum = (NumbersOnly([tblComments].[Address])
WHERE (((tblData2.Year)<"1990"))
ORDER BY tblData2.LineNum;
Code:
Function NumbersOnly(loc) As String
Dim RE As Object, REMatches As Object
Set RE = CreateObject("vbscript.regexp")
RE.Pattern = "\d+"
If (RE.Test(loc) = True) Then
Set REMatches = RE.Execute(loc)
NumbersOnly = REMatches(0)
End If
Set REMatches = Nothing
Set RE = Nothing
End Function
Trust the above shows the problem. Perhaps I cannot use a function in this manner, but maybe there's a workaround?
Any advice appreciated. Thanks.