Split and UBound code snippet?

Results 1 to 2 of 2

Thread: Split and UBound code snippet?

  1. #1
    Join Date
    Dec 1969

    Default Split and UBound code snippet?

    Hello all..<BR>Yesterday, got some really good help from some experts here...and wondered if someone could look at this code for me and see why it&#039;s not working.<BR><BR>I have a &#060;textarea&#062; with <BR> in it. I replace them with vbcrlf items to properly format the area...which is usually about 4 to 8 lines of data, but I&#039;m trying to find out how many lines there are in this &#060;textarea&#062;?<BR><BR>I&#039;m trying to use the <BR> to set up an array with Split, and then ask the UBound of that array to find out how many lines there are...here&#039;s my code which returns 1???<BR><BR>DIM strNewOne, arrNewArray, numLines<BR><BR>&#060;% <BR>strNewOne = rs.fields("SALESDATA")<BR><BR>arrNewArray = Split(strNewOne, "<BR>")<BR><BR>numLines = UBound(arrNewArray)<BR><BR>%&#062;<BR><BR>This returns 1 right now, but there are 5 lines in the SALESDATA field in Access2000 dbase.<BR><BR>???<BR><BR>Jim<BR><BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Split and UBound code snippet?

    TEXTAREAs would normally contain vbCrLfs anyway, rather than &lt;BR&gt;s. If you wanted to show the text gleaned from a TEXTAREA as plain old text you use Replace(strTextArea, vbCrLf, "&lt;BR&gt;"), but you wouldn&#039;t normally work the other way round.<BR><BR>If you look at the database field in the table in Access and it shows n distinct lines, that means that there&#039;s vbCrLfs in it, not &lt;BR&gt;s, so you&#039;d want to use:<BR><BR>&#060;% <BR>strNewOne = rs.fields("SALESDATA")<BR>arrNewArray = Split(strNewOne, vbCrLf)<BR>numLines = UBound(arrNewArray)+1<BR>%&#062;<BR>

Posting Permissions

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