Thanks again Tarwyn,
This is the entire code for this ASP...
My objectives are to:
- Display the listbox (populated) and the footer menu links
- Then if a phone ext is selected from the list...
display :
-'Calls From Extension abcd'
-'Number of Calls listed: 999'
-The ext listbox
-followed by the table rows showing all the phone calls for the extension the user selected
-followed by the footer menu links
All this works fine... except that, after a n ext is selected... the listbox gets moved to AFTER the table rows
As you can see...the onChange="Ext.submit()" resubmits the page. Is that the problem ?
Thanks for any help, John
<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<!--John Bates October 2002-->
<!--#include file="adovbs.inc"-->
<!--#include file="Connect.asp"-->
<%
Dim OrigExt, CallDesc, CalledNo, CallingNo, CallDate, DurHH, DurMM, DurSS, AuthCode
Dim i
Dim rs
Dim sql
Dim selectExt,newExt
Dim intRecs
Dim blnFirstTime
Dim blnTimeout
blnTimeout = False
blnFirstTime = True
'Set Timeout limit it is SECONDS
server.ScriptTimeout = 120
%>
<%
'Select the call records, build the recordset
SelectData(selectExt)
sub DisplayTable
If blnTimeout = True Then
Response.Write "<H2><B>Timeout occurred - too many records selected - please change selection criteria to select less data<BR></H2></B>"
End If
Response.Write "<H2><B>Calls From Phone Extension: " & selectExt & "</H2></B>"
Response.Write "<H4><B>Number of Calls Listed: " & intRecs & "</H4></B>"
response.write "<TABLE cellspacing=2 border=1 align=center>"
' Build column headings
response.write "<tr>"
response.write "<td><B>Ext</B></TD>"
response.write "<td><B>Description</B></TD>"
response.write "<td><B>No. Called</B></TD>"
response.write "<td><B>Calling No.</B></TD>"
response.write "<td><B>Date of Call</B></TD>"
response.write "<td><B>Hours</B></TD>"
response.write "<td><B>Mins</B></TD>"
response.write "<td><B>Secs</B></TD>"
response.write "<td><B>Auth Code</B></TD>"
response.write "</tr>"
' Read thru recordset and write the table rows
DO WHILE NOT rs.eof
' put fields into variables
OrigExt=rs("OrigExt"

CallDesc=rs("RecDesc"

CalledNo=rs("CalledNo"

CallingNo=rs("CallingNo"

CallDate=rs("CallDate"

DurHH=rs("DurHH"

DurMM=rs("DurMM"

DurSS=rs("DurSS"

AuthCode=rs("AuthCode"
' write the fields to browser table
response.write "<tr>"
response.write "<td>"
response.write rs("OrigExt"

& "<br>"
response.write "</td>"
response.write "<td>"
response.write CallDesc & "<br>"
response.write "</td>"
response.write "<td>"
response.write CalledNo & "<br>"
response.write "</td>"
response.write "<td>"
response.write CallingNo & "<br>"
response.write "</td>"
response.write "<td>"
response.write CallDate & "<br>"
response.write "</td>"
response.write "<td>"
response.write DurHH & "<br>"
response.write "</td>"
response.write "<td>"
response.write DurMM & "<br>"
response.write "</td>"
response.write "<td>"
response.write DurSS & "<br>"
response.write "</td>"
response.write "<td>"
response.write AuthCode & "<br>"
response.write "</td>"
response.write "</tr>"
rs.movenext
LOOP
rs.Close
Set rs=Nothing
response.write "</TABLE>"
blnFirstTime = False
End Sub
sub SelectData(selectExt)
sql = "SELECT OrigExt, RecDesc, CalledNo, CallingNo, CallDate, DurHH, DurMM, DurSs, AuthCode FROM Calls WHERE OrigExt = '" & selectExt & "' ORDER BY CallDate"
set rs = createobject("adodb.recordset"
On error resume next
rs.open sql,conn, adOpenStatic, adLockReadOnly, adCmdText
If err <> 0 Then
If instr(err.description) = "ASP 0113" Then
blnTimeout = True
End If
End If
intRecs = rs.RecordCount
End Sub
%>
<HTML>
<HEAD>
<TITLE>Phone Calls for Selected Extension - EHP Springfield</TITLE>
<style type="text/css">
h2
{
font-family: Arial;
color:#990033;
}
TD
{
font-weight: bold;
}
</style>
</HEAD>
<body bgcolor="#FFFFFF">
<FORM NAME="Ext">
<CENTER>
<%
'Set a default extension to display as web page is initialized
selectExt = "9999"
'Check value of EXT, the dropdown box, to see if user has requested a different phone extension
newExt = Request("EXT"

If newExt <> "" Then
selectExt = newExt
End If
'Call the sub to select call data for the requested extension
If selectExt <> "9999" Then
SelectData(selectExt)
DisplayTable
End If
blnFirstTime = False
%>
<%
'Build the dropdown box entries from the extension in Extensions table
sql = "SELECT Ext FROM Extensions WHERE Ext > 0 ORDER BY Ext"
set rs = createobject("adodb.recordset"
rs.open sql,conn, adOpenStatic, adLockReadOnly, adCmdText
%>
<BR>
<SELECT NAME="EXT" size="1" onChange="Ext.submit()">
<option>Select an Extension #</option>
'add all the phone extensions to the dropdown listbox
<%
Do While NOT rs.eof
%>
<option value="<%=rs.Fields("Ext"

%>">
<%=rs.Fields("Ext"

%>
</option>
<%
rs.MoveNext()
Loop
%>
'... end of section that build the dropdown box entries
</SELECT>
</CENTER>
<BR>
<CENTER><TABLE CELLSPACING="0" CELLPADDING="2" BORDER="2">
<TR>
<TD><FONT SIZE=+0><FONT COLOR="#999999">
<A HREF="PhoneLogMenu.html"
onMouseOver="window.status = 'Return to the Phone Call menu';
return(true)">Return to Phone Log menu</A></FONT></FONT></TD>
<TD><FONT COLOR="#999999"><FONT SIZE=+0>
<A HREF="CallsByExt.asp"
onMouseOver="window.status = 'Display Phone Calls by Ext';
return(true)">Display Phone Calls by Ext</A></FONT></FONT></TD>
<TD><FONT COLOR="#999999"><FONT SIZE=+0>
<A HREF="faqs.html"
onMouseOver="window.status = 'Frequently Asked Questions';
return(true)">F.A.Q.s</A></FONT></FONT></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<%
rs.close
conn.close
Set rs = nothing
set conn = nothing
%>