Dim SQL, rs
SQL = "SELECT DateID, Dates FROM tblDates"
Set rs = connection.execute(SQL)
<select name="cboList">
<option value="">Select an option</option>
<%
If Not (rs.EOF and rs.BOF) Then
rs.movefirst
Do Until rs.EOF
If CInt(intID) = CInt(rs.fields("DateID") Then%>
<option value="<%=rs.fields("DateID"%>" selected><%=rs.fields("Dates"%></option>
<%Else%>
<option value="<%=rs.fields("DateID"%>"><%=rs.fields("Dates"%></option>
<%End If
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
%>
</select>
<option value="<%=(objRS("[MONTH/YEAR]"%>"><%=(objRS("[MONTH/YEAR]"%></option> To err is human, but to really foul things up requires a computer.
- Farmers' Almanac, 1978
1) Are you sure that your query returns results?
2) Is there an error message, or is the select box blank?
If you are sure that your query returns results and there is no error message, try this:
objComm.CommandText = "SELECT tblSurveyRawData.[MONTH/YEAR] as TheDate FROM tblSurveyRawData GROUP BY tblSurveyRawData.[MONTH/YEAR]"
objComm.commandType = adCmdText
Set objRS = objComm.Execute
%>
<select name="BeginQrtDate">
<option value="">Select an option</option>
<%
While (NOT objRS.EOF)
%>
<option value="<%=(objRS("theDate"%>"><%=(objRS("theDate"%></option>
<%
objRS.MoveNext
Wend
%>
</select><br><br>
<%
objRS.Close
Set objComm = Nothing
Set objRS = Nothing
%>
Just in case ASP doesn't like the / character in field names.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.