How to Count the Characters of a Field?

  • Thread starter Thread starter Frank Dulk
  • Start date Start date
F

Frank Dulk

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

how do I do?
 
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
 
Here's a quick and doubtless inefficient method, but it's a cute
one-liner:

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