Loop Count

  • Thread starter NeonSky via AccessMonster.com
  • Start date
N

NeonSky via AccessMonster.com

Hello,

I have a rather straightforward question for your consideration.

My source table is as follows.....

FieldA FieldB
Joe 23, 45
Joe 42, 65, 504

What I would like my output to perform is as follows....where field C is a
count of the number of strings in FeldB

FieldA FieldB FieldC
Joe 23, 45 2
Joe 42, 65, 504 3

My source data does indeed include commas in the field, and the values are
distinct. I understand this is poor index structure though these outputs are
specific to a process that references properly indexed data.

Would anyone know how to set up a loop/counter that scans a field for an
occurance of a comma, counts these occurances, then when it is all said and
done adds +1 to the total. Then finnaly generates these counts to the proper
field (the field that is to store the count does not exist in the source data
table).

Thank you!
 
J

Jeanette Cunningham

Hi,
is there any way to get the count information from the properly indexed data
before it is put into this field with commas separating it? This would be
easier if it is possible to access the normalised data first.

Jeanette Cunningham
 
N

NeonSky via AccessMonster.com

Hello Jeanette,

Thank you for your response.

I was fortunate enough to receive an answer that sums this up at the query
level. In case you might be interested.... Len(FieldX) - Len(Replace(FieldX,
",", "")) + 1 (by Marshall Barton).

Happy Holidays!

Jeanette said:
Hi,
is there any way to get the count information from the properly indexed data
before it is put into this field with commas separating it? This would be
easier if it is possible to access the normalised data first.

Jeanette Cunningham
[quoted text clipped - 28 lines]
Thank you!
 
J

Jeanette Cunningham

Hi,
This is the same issue that Marsh has just answered in another post from
you.
Jeanette Cunningham
 
K

KARL DEWEY

Try this if each is separated by a comma ---
String_Elements: (Len([FieldB])-Len(Replace([FieldB],",","")))+1
 
N

NeonSky via AccessMonster.com

Thanks Jeanette, I am well aware of the multipost rule. An earlier answer to
my other post suggested a loop/count, thus I made another post in regards to
that. Then Marshall made his post after I posted here. Just in case you might
want to know..... Thanks And happy holidays!

Jeanette said:
Hi,
This is the same issue that Marsh has just answered in another post from
you.
Jeanette Cunningham
[quoted text clipped - 28 lines]
Thank you!
 
N

NeonSky via AccessMonster.com

Thanks Jeanette, I am aware of the multipost rule and can understand why it
exists. An earlier answer to my other post suggested a loop/count, thus I
made another post in regards to that. Then Marshall made his post after I
posted here. Just in case you might want to know..... Thanks And happy
holidays!

Jeanette said:
Hi,
This is the same issue that Marsh has just answered in another post from
you.
Jeanette Cunningham
[quoted text clipped - 28 lines]
Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top