The following source code was posted last week on :<br>
<A HREF="
TARGET="_new">
This is a subpage of the DEVX<br>
website that covers numerous programming languages. It also<br>
has archives. A good source for information in the future.<br>
<br>
Modify the following code as you see fit to accomplish<br>
your task. Done in VB5. Good luck !<br>
<br>
Jim - aka Logit<br>
<br>
'Start a default project with FORM1 ... add one<br>
'Command1 button and three text boxes named<br>
'cnt1, cnt2 & cnt3. Paste the following code<br>
'and run. The function will locate and count the<br>
'number of occurences in the string "S" of the<br>
'characters indicated.<br>
<br>
Public Function DCount(ByVal vData As String, _<br>
SP As String) As Integer<br>
Dim x As Integer<br>
Dim n As Integer<br>
If vData = "" Or SP = "" Then Exit Function<br>
vData = Trim(vData)<br>
n = 1<br>
DCount = 1<br>
Do<br>
x = InStr(n, vData, SP, vbTextCompare)<br>
If x > 1 And x < (Len(vData) - Len(SP)) _<br>
Then<br>
DCount = DCount + 1<br>
End If<br>
n = x + Len(SP)<br>
Loop Until x = 0<br>
End Function<br>
Private Sub Command1_Click()<br>
s = "GTL-00030/22*M121222*C001"<br>
<br>
cnt1.Text = DCount(s, "*"

'-> cnt=3<br>
cnt2.Text = DCount(s, "/"

'-> cnt=2<br>
cnt3.Text = DCount(s, "0"

'-> cnt=6<br>
End Sub