Counting characters in a field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a query which will count the total number of incidences of specified
characters in a field. I then need the query to report the total number of
records for which this number is greater than a specified value.

For example, this morning I need to count the total number of incidences of
the characters *, A, B and C in a field called Results. I then need to
return and count the record if the total number of incidences is greater than
4. So, using actual examples, a field with a value of A*ABCEFG (5 incidences)
would count towards the total; GGUCC*BF (4 incidences)would not.

Any help would be appreciated.

Jim Jones
 
See whether the following, typed as a computed field in an empty cell of
your query, works for you.

Occurrences: Len([Results]) - Len(Replace(Replace(Replace(Replace([Results],
"*", ""), "A", ""), "B", ""), "C",""))

You must be using Access 2000 or later to be able to use the Replace
function (and you must have all of the service packs installed for Access
2000)
 
Back
Top