Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Invalid 'for' loop control variable

Posted on 2001-06-23
3
3,747 Views
Last Modified: 2011-09-20
OK basically here is the scoop..



I have dumped a bunch of first names into an array. The array is named FiltUpArray

If I use this:

For Each val In FiltUpArray    
     
     If val = "Joe" Then

     Response.Write "That Name Exist In Your Array!"

      End If
Next
########################

It works pefectly... But.. If I use it as shown below in a form so that I can check the check boxes in the form it craps out with this error:

##########################
Microsoft VBScript compilation error '800a0410'

Invalid 'for' loop control variable

/filtersUpdate_hd.htm, line 156

For Each val in FiltUpArray
-------------^
##########################



############Code I use in HTML form##############
<input type="checkbox"
          <%
          For Each val In FiltUpArray    
            If val = "Acura" Then
          %>
            checked
          <%
            End If
           Next
          %>  
     
          name="Acura" value="ON">
###############################################

Any idea why?
0
Comment
Question by:muchowebdotcom
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 200 total points
ID: 6222420
Try this

<input type="checkbox"
<%
For Each val In FiltUpArray    
     If Cstr(val) = "Acura" Then
          Response.Write " checked "
                Exit For
    End If
Next
%>  
name="Acura">

hongjun
0
 
LVL 1

Author Comment

by:muchowebdotcom
ID: 6222427
I just gave you the points because I already solved it another way.. Thanks and enjoy the points..
0
 
LVL 33

Expert Comment

by:hongjun
ID: 6222435
Oh thanks anyway. Perhaps you just made a careless mistake and that's all. Your logic is there.

hongjun
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question