There is almost always more than one way to do anything.
As long as it works, that's what matters.
If this was a function being called alot, maybe as a query
field, then I would look hard at which way was more
effecient. I'm not sure which would be, but I have an
idea using the Split function would be a bit quicker.
Chris Nebinger
>-----Original Message-----
>Your way is less code!
>
>Kat
>"Chris Nebinger" <(E-Mail Removed)>
wrote in message
>news:1c83f01c452f7$065c5290$(E-Mail Removed)...
>> There are many different ways to do this. One of them
is:
>>
>> Public Function CountCommas(strInput As String) As
Integer
>> Dim Values() As String
>> Values = Split(strInput, ",")
>> CountCommas = UBound(Values)
>> End Function
>>
>>
>> Chris Nebinger
>>
>>
>> >-----Original Message-----
>> >Can you help with the Access expression for counting
the
>> number of commas in a text field? I would like the
>> expression to return a number plus one.
>> >
>> >The text field containing the data is named, "notes"
>> >
>> >So, if the text field contains:
>> >C10, C20, C30
>> >
>> >The expression should return a number 3.
>> >
>> >Many thanks,
>> >Matt
>> >.
>> >
>
>
>.
>
|