This code comes from a form I use which has the Field paragraph which contains text to be counted
and numeric field Count
code should be inserted in after update property
'==== code begins
Dim i As Integer
Me![Count] = 0
For i = 1 To 250
Me![Count] = Me![Count] + IIf(Mid$(Me![Paragraph], i, 1) = "" Or Mid$(Me![Paragraph], i, 1) = " ", 0, 1)
Next i
'======= code ends
the for next loop has been set to 250 the nos of characters in the field paragraph
but still, the question itself is sufficiently vague to mis-lead. It ASKS for a "character count", and shows an example to avoid (aparently) counting spaces. It DOES not explain if the "character count" should also not 'count' the traditional "white space", punctuation and (or) other special characters. Nor doe the question specify even the file 'type' as plain text (could be a WORD.DOC file or an Excel.XLS or ... ?)
Michael,
You're right. I seem to go back and forth with this kind of thing when browsing posts - should I try to look for the big picture and see if I can ferret out the question behind the question (the *root* issue)? - or just answer the question that was asked? I dunno, guess it just depends on the mood I'm in at the moment...
Eupher, I think many responses in the 'public domain' are done that way, including my own. It is just that this one seems particularly obtuse. A rose by any other name may still be a rose, but the valid alaises of 'character' (even in nerd land) are both multituninious and diverse in their meaning.
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.