I have made a mistake in the use of a dynamic array, but cannot seem to find the bug. I am using a dynamic array to create a dropdown. Very simple code inside of the function that creates the array, but it appears to be adding to the endo of each bound everything i have created to that point.
Example:
(0)A
(1)AB
(2)ABC
(3)ABCD
Where it should be
(0)A
(1)B
(2)C
(3)D
The code is below, any ideas would be appreciated.
set con=server.CreateObject("adodb.connection"
'connection object
con.Open application("constr"
dim strInfo
strInfo = ""
dim arrGroup()
i = 0
sql = ""
sql = sql & "Select *"
sql = sql & " from table"
Dim Rs
Set Rs = server.createobject ("adodb.recordset"
Rs.Open Sql, con, 2, 2
Do until Rs.Eof
if rs.fields("show"
.value <> "N" then
if rs.fields("grp"
.value = strGroup then
strInfo = strInfo & "<option SELECTED"
else
strInfo = strInfo & "<option "
end if
strInfo = strInfo & " value='"& rs.fields("grp"
.value &"'>" & rs.fields("descr"
.value &"</option>"
ReDim preserve arrGroup(i)
arrGroup(i) = strInfo
i = i + 1
End if
Rs.Movenext
Loop
Micah A. Norman
Example:
(0)A
(1)AB
(2)ABC
(3)ABCD
Where it should be
(0)A
(1)B
(2)C
(3)D
The code is below, any ideas would be appreciated.
set con=server.CreateObject("adodb.connection"
con.Open application("constr"
dim strInfo
strInfo = ""
dim arrGroup()
i = 0
sql = ""
sql = sql & "Select *"
sql = sql & " from table"
Dim Rs
Set Rs = server.createobject ("adodb.recordset"
Rs.Open Sql, con, 2, 2
Do until Rs.Eof
if rs.fields("show"
if rs.fields("grp"
strInfo = strInfo & "<option SELECTED"
else
strInfo = strInfo & "<option "
end if
strInfo = strInfo & " value='"& rs.fields("grp"
ReDim preserve arrGroup(i)
arrGroup(i) = strInfo
i = i + 1
End if
Rs.Movenext
Loop
Micah A. Norman