How to Count the Characters of a Field?

F

Frank Dulk

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

how do I do?
 
M

msmcnewsxp

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
 
D

Dirk Goldgar

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top