# How to Count the Characters of a Field? - Microsoft Access

I want to discover how many times the bar (/) appears inside of the field numnota how do I do?...

1. ## How to Count the Characters of a Field?

I want to discover how many times the bar (/) appears inside of the field
numnota

how do I do?

Frank Dulk Guest

2. ## Re: How to Count the Characters of a Field?

As I make this function?

"msmcnewsxp" <mcourtermindspring.com> escreveu na mensagem
news:O6Fr8OvSDHA.1868TK2MSFTNGP11.phx.gbl...
> you could write a vba routine using a for loop to len of field value and
> count using instr(myfield,"'") > 0.
>
>
> "Frank Dulk" <fdulkbol.com.br> wrote in message
> news:uX1tEGvSDHA.212TK2MSFTNGP10.phx.gbl...
> >
> >
> >
> > I want to discover how many times the bar (/) appears inside of the
field
> > numnota
> >
> > how do I do?
> >
> >
>
>

Frank Dulk Guest

3. ## Re: How to Count the Characters of a Field?

You have to use the Instr function and loop through the string.

"Frank Dulk" <fdulkbol.com.br> wrote in message
news:uX1tEGvSDHA.212TK2MSFTNGP10.phx.gbl...
>
>
>
> I want to discover how many times the bar (/) appears inside of the field
> numnota
>
> how do I do?
>
>

Mike Painter Guest

4. ## Re: How to Count the Characters of a Field?

pick an event for the control like lostfocus

dim x as integer
dim y as integer

for x = 1 to len(numnota.value)
if instr(mid(numnota.value,x,1),"/") > 0 then y = y + 1
next x

msmcnewsxp Guest

5. ## Re: How to Count the Characters of a Field?

Here's a quick and doubtless inefficient method, but it's a cute
one-liner:

lngCount = UBound(Split([numntota] & " ","/",,vbBinaryCompare))

--
Dirk Goldgar, MS Access MVP
[url]www.datagnostics.com[/url]

"Mike Painter" <mpainteratattdotnet> wrote in message
news:c9e7a1748dfb203c8b2bd7289b0d75ecfree.teranew s.com
> You have to use the Instr function and loop through the string.
>
>
>
>
> "Frank Dulk" <fdulkbol.com.br> wrote in message
> news:uX1tEGvSDHA.212TK2MSFTNGP10.phx.gbl...
>>
>>
>>
>> I want to discover how many times the bar (/) appears inside of the
>> field numnota
>>
>> how do I do?

Dirk Goldgar Guest

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•