Counting number of items in a string - desperately

Results 1 to 3 of 3

Thread: Counting number of items in a string - desperately

  1. #1
    Join Date
    Dec 1969

    Default Counting number of items in a string - desperately

    Hi - I am trying to loop through items in a table that are stored like this: <BR> <BR> <BR><BR><BR>Morbid Obesity,Multiple Sclerosis<BR> <BR>Morbid Obesity,Multiple Sclerosis,Arthritis,<BR><BR>Breast Cancer,Multiple Sclerosis,<BR> <BR>Morbid Obesity, Multiple Sclerosis, Heart Failure<BR> <BR> <BR>and I am trying to count the number of items in each record. For some reason everything I am trying is returning an incorrect record set. I am wondering first of all if it is because some records have a few items and end in a comma, where others have the same amount and don&#039;t end in a comma - so therefore basing the count on a comma retuns the wrong number of records? If anyone can help me I would appreciate it so much!<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default You want this?

    Number of items in a recordset? Just do this...<BR><BR>NumItems=rs.RecordCount<BR><BR>You have to change cursor types for this to work or else it will return a -1... this is an article about that here somewhere, just search for changing cursors.

  3. #3
    Join Date
    Dec 1969

    Default Do this

    say the field is diseases<BR><BR>so<BR><BR>dim myArr,i,itemCount<BR><BR>myArr = Split(rs("diseases"),",")<BR>For i = 0 to ubound(myArr)<BR> if myArr(i)&#060;&#062;"" Then itemCount=itemCount+1<BR>Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts