Re: Code for counting commas in a text field?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Chris Nebinger (anonymous_at_discussions.microsoft.com)
Date: 06/15/04


Date: Tue, 15 Jun 2004 11:28:42 -0700

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" <anonymous@discussions.microsoft.com>
wrote in message
>news:1c83f01c452f7$065c5290$a301280a@phx.gbl...
>> 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
>> >.
>> >
>
>
>.
>



Relevant Pages

  • Re: Beginners Program
    ... It is one of my first programs, ... > # isn't special and doesn't need to be escaped in a double quoted string. ... >> alot more understandable ... > input file things could go wrong. ...
    (comp.lang.perl.misc)
  • RE: Domain Aggregate Function with AND Operator
    ... Chris Nebinger ... > Public Function WOCount(di As String, ... > Dim strcstr As String ... is the text version of the Work Order. ...
    (microsoft.public.access.modulesdaovba)
  • RE: Split Data within a column.
    ... I tried alot of different combinations of the queries I found on this site ... Mid will return a zero length string ...
    (microsoft.public.access.queries)
  • RE: Domain Aggregate Function with AND Operator
    ... > Chris Nebinger ... >> Public Function WOCount(di As String, ... >> Dim strcstr As String ... is the text version of the Work Order. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Using ATL::Trace we receive "Incorrect format specifier"
    ... We have alot of legacy code which uses 'TRACE' with only a string ... if a string you pass to TRACE ...
    (microsoft.public.vc.atl)