Problem concatenating a string

what i need to do is that when I loop through a recordset i get some ids.
These Ids are in a lump (Start and end)

For each lump(eg numberC_Start and numberC_END )I need to get all the number from start to end
and concatanate it in a string .

How can I do it?


Code:
dim numberA_Start as long
dim numberB_Start as long
dim numberC_Start as long

dim numberA_END as long
dim numberB_END as long
dim numberC_END as long


numberA_Start =5
numberA_END =5

numberB_Start =66
numberB_END =69

numberC_Start =91
numberC_END =95


dim strResult as string

strResult=5/66/67/68/69/91/92/93/94/95/



EG of a loop

Dim tempFirstNumber as long,tempLastNumber as long,tempStrResult as string
dim rs as adodb.Recorset,Delimiter as string

set Delimiter="/"
set rs=GetStuff......

   do while not rs.eof
      tempFirstNumber =rs.fields("FirstNum").value
       tempLastNumber =rs.fields("LastNum").value
     'HELP
      '//calcuLate all the numbers within first and last and concatanate in a string


      rs.movenext
   loop
   tempStrResult

 

Thanks a lot in advance
Gabriel_BrienzaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

g_johnsonCommented:
 do while not rs.eof
      tempFirstNumber =rs.fields("FirstNum").value
       tempLastNumber =rs.fields("LastNum").value
     'HELP
      '//calcuLate all the numbers within first and last and concatanate in a string
      for i = tempfirsnumber to templastnumber
             mySTring = mystring & cstr(i) & "/"
      next 'i

      rs.movenext
   loop
   tempStrResult


is that what you're looking for?
0
TimCotteeHead of Software ServicesCommented:
Hi Gabriel_Brienza,

set Delimiter="/"
set rs=GetStuff......

   do while not rs.eof
      tempFirstNumber =rs.fields("FirstNum").value
       tempLastNumber =rs.fields("LastNum").value
     'HELP
     For i = tempFirstNumber To tempLastNumber
            strTheNumbers = strTheNumbers & Cstr(i) & Delimiter
    Next
    strTheNumbers = Left(strTheNumbers,Len(strTheNumbers)-1) 'trims off the trailing delimiter

      rs.movenext
   loop
   tempStrResult

Tim Cottee
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gabriel_BrienzaAuthor Commented:
thanks guys
that both worked and I didnt know who to assign the answer to.I decide to split .
Hope its fair

Thanks for your great and quick answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.