Web Analytics Made Easy -
StatCounter Different last record - CodingForum

Announcement

Collapse
No announcement yet.

Different last record

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Different last record

    Hi,

    I am getting some city names from the database and write them with a loop.
    After each city name my code adds a comma. I want the last record not to write the comma
    e.g.

    Marmaris, Bodrum, Fethiye, Gocek

    Anybody knows how to do?

    Thanks

    Ceyhun
    telmessos - Coder
    http://www.realestateinturkey.com - http://www.propertysearchturkey.co.uk

  • #2
    [pseudo-code]

    strMyList = ""
    for each record in recordset
    strMyList = strMyList & recordset.fields("fieldname") & ", "
    next
    strMyList = left(strMyList,len(strMyList)-2)

    [/pseudo-code]

    Each time you add an item to the list, you put 2 characters on the end (a space and a comma). When the list is done, you just chop the last two characters off the end. Make sense?

    Comment

    Working...
    X