Solved

Invalid 'for' loop control variable

Posted on 2001-06-23
3
3,726 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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