Character counting without spaces (1 Viewer)

des-Toblaave

New member
Local time
Today, 11:16
Joined
Mar 22, 2024
Messages
4
Hi I new to access and I’m trying to have a text box that counts only the characters in another text box. This is a viral piece to allow me to get all of my company’s admin away from lots of word files and on to access. Please help, I have one txt box called “inscription” and the other is called “character count”
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:16
Joined
Feb 19, 2013
Messages
16,612
No example provided so guessing if the text is ‘hello world’ you want a count of 10, not 11

in which case try

Len(Replace(“hello world”,” “,””))
 

des-Toblaave

New member
Local time
Today, 11:16
Joined
Mar 22, 2024
Messages
4
Sorry for not being clear, I’m very new to this. I’ll try to explain more. One text box where the amount of text is different for each record. I need to know what vb code to add to a second text box so that I can see the amount of characters without spaces. It’s to be used to calculate a price based upon the number of characters. I hope that helps
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:16
Joined
Feb 19, 2013
Messages
16,612
I’ll try to explain more.
if in doubt - show an example rather than describing it

and did you try the example I provided?

in a query it would be something like

SELECT myField, Len(Replace([MyField],” “,””)) as CharCount
FROM myTable

Alternatively in a form the controlsource for the CharCount control would be

=Len(Replace([MyField],” “,””))
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:16
Joined
Jan 23, 2006
Messages
15,379
DT,

Can you tell us more about the following?
used to calculate a price based upon the number of characters.
It might be helpful if you could tell readers a little about the "business" involved and where database fits/might fit with the production/administration or ?? of word documents. CJ has given responses to your specific question, but perhaps there is more involved than just counting characters.
 

des-Toblaave

New member
Local time
Today, 11:16
Joined
Mar 22, 2024
Messages
4
The issue is probably more one of me not knowing where to put the answer CJ has given. I was hoping for a full explanation as I said I’m very new to this but the answer seems to assume my knowledge level is higher than it is.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:16
Joined
Sep 21, 2011
Messages
14,301
The issue is probably more one of me not knowing where to put the answer CJ has given. I was hoping for a full explanation as I said I’m very new to this but the answer seems to assume my knowledge level is higher than it is.
n a query it would be something like

SELECT myField, Len(Replace([MyField],” “,””)) as CharCount
FROM myTable

Alternatively in a form the controlsource for the CharCount control would be

=Len(Replace([MyField],” “,””))
Other than typing it in himself, little more he can say about it? :(
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:16
Joined
May 7, 2009
Messages
19,243
here is a demo, open Form1 and see the code (VBA) in Module1.
 

Attachments

  • NumberOfChars.accdb
    608 KB · Views: 20

Users who are viewing this thread

Top Bottom