Using Replace with Split

Results 1 to 2 of 2

Thread: Using Replace with Split

  1. #1
    Bonusamy Guest

    Default Using Replace with Split

    I have a field with contact name, containg both last and first names. SO I am parsing them to make two fields, first and last.<BR>I am using the replace function with the pipe (&#124) replacing a space. Then I am trying to split things at the pipe, I get this error: An unhandled data type was encountered.<BR><BR>do while not rs.eof<BR>XX=rs("contactname")<BR>zz= replace(xx, " ",",")<BR>tmpArr = split(zz, ",")<BR><BR>key1=tmpArr(0)<BR>key2=tmpArr(1)<BR>ke y3=keysarray(2)<BR>key4=keysarray(3)<BR><BR>Should n&#039;t this work?

  2. #2
    Join Date
    Dec 1969

    Default RE: Using Replace with Split

    I don&#039;t see the &#124 anywhere in there...<BR><BR>after you do your replace, Response.Write out your string, so you can see if there is something funny in there. If not, place On Error Resume Next, and split your array. Then, loop through all the values and look in there. You&#039;ll find the error in one of your elements.<BR><BR>Also, make sure you declare tmpArr as variant, not as a variant array. And since you&#039;re in a loop, you may have to erase the array through each pass.<BR><BR>Does it work outside of your do loop?

Posting Permissions

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