In Word 2013, I can do a word count on a document under REVIEW.
Does such a thing exist in ACCESS 2013?
In Word 2013, I can do a word count on a document under REVIEW.
Does such a thing exist in ACCESS 2013?
youd have to write your own, or get one from this forum.
Hi
Use this Function
Code:Function WordCount(ByRef Str As String) As Long Dim cnt As Long Dim Words As Long Words = 0 WordCount = 0 If Len(Str) = 0 Then Exit Function End If For cnt = 1 To Len(Str) Select Case Mid(Str, cnt, 1) Case " " Words = Words + 1 Case "." Words = Words + 1 Case "," Words = Words + 1 Case ";" Words = Words + 1 Case ":" Words = Words + 1 Case "-" Words = Words + 1 End Select Next cnt If Words = 0 Then Words = 1 WordCount = Words End Function
You can PM me if you need further help.
Good Reading https://docs.microsoft.com/en-gb/off...on-description
Then in a query you can use this:-
Count: Wordcount(Nz([Item_Notes],""))
You can PM me if you need further help.
Good Reading https://docs.microsoft.com/en-gb/off...on-description
@mike60smartHi
Use this Function
Code:Function WordCount(ByRef Str As String) As Long Dim cnt As Long Dim Words As Long Words = 0 WordCount = 0 If Len(Str) = 0 Then Exit Function End If For cnt = 1 To Len(Str) Select Case Mid(Str, cnt, 1) Case " " Words = Words + 1 Case "." Words = Words + 1 Case "," Words = Words + 1 Case ";" Words = Words + 1 Case ":" Words = Words + 1 Case "-" Words = Words + 1 End Select Next cnt If Words = 0 Then Words = 1 WordCount = Words End Function
I had always thought hyphenated words counted as 1?.
Hyphenated words in Word do count as 1?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Hi Welshgasman
The function used in a query produced the following results:-
You can PM me if you need further help.
Good Reading https://docs.microsoft.com/en-gb/off...on-description
They are not hyphenated though?, there is a space each side of the "-" character?
Plus
Additional detail – WW ROHS shows up as 4 words in Word?
Additional detail – WW ROHS, 1.5x batt = 3600mAh shows up as 8 words ?
I cannot really see if your , in the last entry has a space after it, but would make it worse if it does not?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Yes The function appears to count the Hyphens and the Comma as a word so not 100% accurate.
I would imagine the Function needs tweaking slightly to ignore Hyphens & Commas. I would not have a clue as to how it can be tweeked as
my VB Skills are minimal.
You can PM me if you need further help.
Good Reading https://docs.microsoft.com/en-gb/off...on-description
I was thinking of using the Split() function with a space?
If a word ends with a , it is still one word?, same for other characters.?
If for some reason multiple delimiters are needed then this link shows a way.
https://stackoverflow.com/questions/...s-in-vba-excel
Only the O/P knows what he needs, but I was going on what Word produces as a word count.
Thorough testing would be required of course?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Word must have its own definition. I just tested a sql statement in Word and the result was 48. IMO that is only about 50 words short of what I would count.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
I used Micron's response
Just replace each space with space--> gives me 32 which seems to match the word count.Word must have its own definition. I just tested a sql statement in Word and the result was 48. IMO that is only about 50 words short of what I would count.
So counting spaces may be quick and dirty method. How exact must your count be?
@orange, what is the input for that comment? I don't understand. Surely it's not the record that's counted as 10?
What I've not seen yet is an input and expected result from OP and until we get that I'm going to sit on the sidelines.
IMO, that field is 5 words but the exact words are unknown because of the lack of info. If = is not a word, then which of these is the word: 1.5 or 1.5x since x is also a mathematical symbol, just like = ? Perhaps the count is more important so it doesn't matter, but I dare say there will be cases where lack of tight rules could be an issue. At best, I think an approximation is all that could be hoped for.WW
ROHS
1.5x
batt
3600mAh
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
micron,
I quoted your response post #10. And used that.
I copied the 2 sentences, pasted in Notepad++ and replaced space with space. 32 replacements.
Now if you have user inputted text, I would suggest you remove all double (or more) contiguous spaces to single space, then do the replace. Seems it could be a fairly simple function, but accuracy and specific instruction/requirement details needed before any further suggestions.
A function:
Code:' ---------------------------------------------------------------- ' Procedure Name: GetWordCount ' Purpose: Get a word count from a string based on number of spaces in the input ' Procedure Kind: Function ' Procedure Access: Public ' Parameter s (String): the string to be parsed for word count ' Return Type: Integer ' Author: Jack ' Date: 01-Jul-21 ' ---------------------------------------------------------------- Function GetWordCount(s As String) As Integer Dim StringIn As Variant If Len(s) = 0 Then GetWordCount = 0 Else StringIn = Split(s, " ") GetWordCount = UBound(StringIn) + 1 'must account for array element(0) End If End Function
YES : Yes, word count is what I'm trying to get. In MS Word REVIEW tab the WORD FOUNT function providesI was thinking of using the Split() function with a space?
If a word ends with a , it is still one word?, same for other characters.?
If for some reason multiple delimiters are needed then this link shows a way.
https://stackoverflow.com/questions/...s-in-vba-excel
Only the O/P knows what he needs, but I was going on what Word produces as a word count.
Thorough testing would be required of course?
Pages
Words
Characters (With spaces)
Characters (Without spaces)
Paragragraphs, and
Lines
Post 14 was moderated, I'm posting to trigger email notifications.