Count characters between other characters

kimperkins1

New member
Local time
Yesterday, 16:28
Joined
Jan 17, 2012
Messages
6
What's the VBA code to return the number of characters between specific characters? For example, I need to find the number of characters between two hyphens - "-xxxxxx-".
 
Here's a link to a list of VBA functions:
http://www.techonthenet.com/access/functions/

Working backwards, this is how you would accomplish it:

Use the Len() function to get the length of a string
Use the Mid() function to get a substring of another string
Use the Instr() function to determine the position of certain characters in a string
 
Sorry, I'm a rookie. Instr only gets me the position of the first hyphen. Do I need to progressively dissect the string to get the count to the second one?
 
you could use split to divide the string into an array then just take len of the array index you want.
 

Users who are viewing this thread

Back
Top Bottom