What's an easier way to do this?

# Thread: What's an easier way to do this?

1. dep
Senior Member
Join Date
Dec 1969
Posts
709

## What's an easier way to do this?

A for, next loop doesn&#039;t seem to work. Thanks for any help. :) This is probably a case of "thinking too hard on a simple problem"<BR><BR>accomp1 = Request.form("accomp1")<BR>accomp2 = Request.form("accomp2")<BR>accomp3 = Request.form("accomp3")<BR>accomp4 = Request.form("accomp4")<BR>accomp5 = Request.form("accomp5")<BR>accomp6 = Request.form("accomp6")<BR>accomp7 = Request.form("accomp7")<BR>accomp8 = Request.form("accomp8")<BR>accomp9 = Request.form("accomp9")<BR>accomp10 = Request.form("accomp10")<BR>accomp11 = Request.form("accomp11")<BR>accomp12 = Request.form("accomp12")<BR>accomp13 = Request.form("accomp13")<BR>accomp14 = Request.form("accomp14")<BR>accomp15 = Request.form("accomp15")<BR>accomp16 = Request.form("accomp16")<BR>accomp17 = Request.form("accomp17")<BR>accomp18 = Request.form("accomp18")<BR>accomp19 = Request.form("accomp19")<BR>accomp20 = Request.form("accomp20")<BR><BR>if not(isnull(accomp1)) then accomp1=replace(accomp1, "&#039;", "&#039;&#039;") <BR>if not(isnull(accomp2)) then accomp2=replace(accomp2, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp3)) then accomp3=replace(accomp3, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp4)) then accomp4=replace(accomp4, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp5)) then accomp5=replace(accomp5, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp6)) then accomp6=replace(accomp6, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp7)) then accomp7=replace(accomp7, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp8)) then accomp8=replace(accomp8, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp9)) then accomp9=replace(accomp9, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp10)) then accomp10=replace(accomp10, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp11)) then accomp11=replace(accomp11, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp12)) then accomp12=replace(accomp12, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp13)) then accomp13=replace(accomp13, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp14)) then accomp14=replace(accomp14, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp15)) then accomp15=replace(accomp15, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp16)) then accomp16=replace(accomp16, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp17)) then accomp17=replace(accomp17, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp18)) then accomp18=replace(accomp18, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp19)) then accomp19=replace(accomp19, "&#039;", "&#039;&#039;")<BR>if not(isnull(accomp20)) then accomp20=replace(accomp20, "&#039;", "&#039;&#039;")<BR>

2. Senior Member
Join Date
Dec 1969
Posts
11,247

## RE: What's an easier way to do this?

loop through<BR><BR>for x = 1 to 20 <BR> accomp(x) = replace(accomp(x), "&#039;", "&#039;&#039;")<BR>next

3. Senior Member
Join Date
Dec 1969
Posts
4,697

## RE: What's an easier way to do this?

With a function first. I try to avoid naming things on to 10.<BR><BR>accomp1 = SomthingHere("accomp1")<BR><BR><BR>Function SomthingHere(RequestItemName)<BR> Dim baseValue : baseValue = Request.form(RequestItemName)<BR> if isnull(baseValue)then <BR> SomthingHere="" &#039; Default value<BR> else<BR> SomthingHere=replace(baseValue, "&#039;", "&#039;&#039;") <BR> end if<BR>End Function

4. dep
Senior Member
Join Date
Dec 1969
Posts
709

## a for loop doesn't work in this case... (nt)

.

#### Posting Permissions

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