Try this function to look for caps (copy and paste it into a module) in your query
Function FindAllCaps(str As String) As Boolean
Dim i As Long
i = 1
Do Until i = Len(str)
If Asc(Mid$(str, i, 1)) < 65 Or Asc(Mid$(str, i, 1)) > 90 Then
FindAllCaps = False
Exit Function
End If
i = i + 1
Loop
FindAllCaps = True
End Function
To look for the '#' modify the above function to use Asc(35)
Let me know if this is what you're looking for, or if you want to know what's going on in the Function.
Ooops!
I found a problem with the function I sent you (remember you get what you paid for ;-)
Try this function instead;
Function FindAllCaps(str As String) As Boolean
Dim i As Long
i = 1
Do
If Asc(Mid$(str, i, 1)) < 65 Or Asc(Mid$(str, i, 1)) > 90 Then
FindAllCaps = False
Exit Function
End If
i = i + 1
Loop Until i = Len(str) + 1
FindAllCaps = True
End Function
Anyway...
In the first row of the design grid called "Field:" put something like this;
AllCaps:FindAllCaps([YourTable].[FieldThatHasCaps])
You are creating a new field in this query called "AllCaps" that uses the Function "FindAllCaps". The function is looking for caps in the data from the field "FieldThatHasCaps" in the table called "YourTable"
Then in the criteria row put the word True.
Now only records that return True from the function are shown.
Also, put any other fields you might want to see.
To understand the function, look up the keywords Asc, Mid, and ASCII in Help.
One word of caution, this function is fairly raw. It'll return errors if the field contains Null values. Also, there will be no caps found if there are spaces or numbers in the data.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.