[thelist] Part II: ASP, FSO, Replace

darren darren at web-bitch.co.uk
Tue Feb 4 15:42:01 CST 2003


On Tuesday, February 4, 2003 at 21:18, Michele Foster wrote:

MF> But if it equals more than one .. how to do that?  IOW,  this is a
MF> multi-select list, and the values in the DB are such as 1214,3435,2211 (yes,
MF> I am replacing the standard string delimiter ";" with a "," on insert to the
MF> DB so that it'll work in a multiselect form in Access .. Access doesn't like
MF> the ";".)

how about splitting the string you get from the database on the separator
and loop through the array doing the replace on each value??

something like:

   if inStr(str_Citizenship, ",") > 0 then
      arrCitizen = split(str_Citizenship, ",")
      for i = 0 to ubound(arrCitizen, 0)
         strCombo = replace(strCombo, "<option value=""" & arrCitizen(i) & """>",
            "<option selected value=""" & arrCitizen(i) & """>")
      next
   else
      strCombo = replace(strCombo, "<option value=""" & arrCitizen(i) & """>",
         "<option selected value=""" & arrCitizen(i) & """>")
   end if

one thing to note is that string handling in vbscript is rather pants so
if the strCombo is largish, you might find the performance sucks!

hth,

darren.




More information about the thelist mailing list