List Box
I have the code below, which is supposed to populate a list box with
records from the database; if there are not records, then a message is produced,
this works fine, but when there is multiple records in the database,
it has a list box for each seperate record.
I can not seem to find the problem, can anyone help please?
Thanks in advance
I have the code below, which is supposed to populate a list box with
records from the database; if there are not records, then a message is produced,
this works fine, but when there is multiple records in the database,
it has a list box for each seperate record.
I can not seem to find the problem, can anyone help please?
Thanks in advance
Code:
<%
Option Explicit
Dim StrConnect
%>
<!-- #INCLUDE FILE="ProjectConnection.asp" -->
<!-- #INCLUDE FILE="clock.inc" -->
<HTML>
<HEAD>
<TITLE>Add Event Report</TITLE>
</HEAD>
<BODY>
<body bgcolor="#99CCFF">
<font face="Arial">
<form name="theClock" action="addreporttodb.asp" method="post">
<input type=text name="theTime" size=6><% Response.Write Date %><br>
<center><u><b><font size="7">Add an Event Report</font></center></b></u></p>
<BR>
<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Events", strConnect, 3,3
If objRS.BOF and objRS.EOF Then
Response.Write "There are no events to write reports on"
Else
objRS.MoveFirst
Do While Not objRS.EOF
%>
Event Name
<SELECT NAME="txtEventName" SIZE="1">
<%
Response.Write "<OPTION VALUE='" & objRS("EventName") & "'>"
Response.Write objRS("EventName") & "</OPTION>"
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
%>
</SELECT>
Date<input type="text" name = "txtDate" size="20"><BR>
Report<BR>
<textarea name="txtReport" col="200" rows="12" wrap="virtual" cols="40"></textarea> <BR>
<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit"><BR>
<% End If %>
</font>
</form>
</body>
</html>