Hi people,
Im trying to create a dropdown list with a number of areas, which are divided into a group.
I have a table called tblQArea with qareaid, qarea and type.
qarea is a list of all the areas and type is either manufacturing, administration or other.
heres my code so far.
<%Set oRsQArea=Server.CreateObject("ADODB.Recordset")
strSQLQArea = "SELECT DISTINCT qarea, type FROM tblQArea ORDER BY qarea"
oRsQArea.Open strSQLQArea, ConnString
Response.Write "<OPTION>Please Select...</option>"
Do while not oRsQArea.EOF
if rstDBEdit.Fields("tblQArea.QArea") = oRsQArea("qarea") then 'if this is the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRsQArea ("qarea") & "' SELECTED>"
Response.Write oRsQArea("qarea") & "</Option>"
oRsQArea.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRsQArea ("qarea") & "'>"
Response.Write oRsQArea("qarea") & "</Option>"
oRsQArea.MoveNext
end if
loop
oRsQArea.Close
Set oRsQArea=nothing
Set strSQLQArea=nothing%>
this simply list all the qareas, was wondering if i could group them by the type field?
Any ideas?
Im trying to create a dropdown list with a number of areas, which are divided into a group.
I have a table called tblQArea with qareaid, qarea and type.
qarea is a list of all the areas and type is either manufacturing, administration or other.
heres my code so far.
<%Set oRsQArea=Server.CreateObject("ADODB.Recordset")
strSQLQArea = "SELECT DISTINCT qarea, type FROM tblQArea ORDER BY qarea"
oRsQArea.Open strSQLQArea, ConnString
Response.Write "<OPTION>Please Select...</option>"
Do while not oRsQArea.EOF
if rstDBEdit.Fields("tblQArea.QArea") = oRsQArea("qarea") then 'if this is the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRsQArea ("qarea") & "' SELECTED>"
Response.Write oRsQArea("qarea") & "</Option>"
oRsQArea.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRsQArea ("qarea") & "'>"
Response.Write oRsQArea("qarea") & "</Option>"
oRsQArea.MoveNext
end if
loop
oRsQArea.Close
Set oRsQArea=nothing
Set strSQLQArea=nothing%>
this simply list all the qareas, was wondering if i could group them by the type field?
Any ideas?