Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find 3 letter capitals in cells USD GBP EUR etc

Status
Not open for further replies.

richiwatts

Technical User
Jun 21, 2002
180
GB
How do I find all cells that have 3 capitals letters in them.

USD GBP EUR etc

 



Hi,

Are you referring to Access, as Access tables have FIELDS and ROWS not CELLS, or is this Excel?

Do these "cells" CONTAIN these values along with other characters or do the "cell" values EQUAL these values?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
It is Access. This finds all the rows with USD

[Source] Like "*" & "USD" & "*"
 
There is probably an easier way but, you can build a calculated field like this

select is3Caps([source]) as ThreeCaps ......

put this in a module
Code:
Public Function Is3Caps(val As Variant) As Boolean
  Dim i As Integer
  Dim ASC_Val As Long
  If Not IsNull(val) Then
    If Len(val) = 3 Then
      For i = 1 To 3
        ASC_Val = Asc(Mid(val, i, i + 1))
        If ASC_Val < 65 Or ASC_Val > 90 Then Exit Function
       Next i
       Is3Caps = True
    End If
  End If
End Function
return the records where ThreeCaps = true
 
I am using another tools that uses Access in the background and we have no modules.
We can only use queries
 
richiwatts,
Please provide the full context of your postings in the future so responders don't waste their time with solutions that are out of spec.

You might be able to use something like:
Code:
WHERE strComp([FieldName],UCase([FieldName]),vbBinaryCompare)=0
I'm not sure if this will work "using another tool".

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top