Re: Code for counting commas in a text field?
From: Chris Nebinger (anonymous_at_discussions.microsoft.com)
Date: 06/15/04
- Next message: Chris Nebinger: "Quotes within quotes (repost)"
- Previous message: RichardA: "Re: Enter a calculation for an empty column in a table"
- In reply to: Katrina: "Re: Code for counting commas in a text field?"
- Messages sorted by: [ date ] [ thread ]
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
>> >.
>> >
>
>
>.
>
- Next message: Chris Nebinger: "Quotes within quotes (repost)"
- Previous message: RichardA: "Re: Enter a calculation for an empty column in a table"
- In reply to: Katrina: "Re: Code for counting commas in a text field?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|