%
function getDisplayValue(table, indexField, displayField, indexValue)
dim oConnDisplay, oCmdDisplay, rsDisplay, strSQL
set oConnDisplay = Server.CreateObject("ADODB.Connection")
set oCmdDisplay = Server.CreateObject("ADODB.Command")
Set rsDisplay = Server.CreateObject("ADODB.Recordset")
oConnDisplay.Open strConn
oCmdDisplay.ActiveConnection = oConnDisplay
if indexValue <> "" then
strSQL = "select " & displayField & " from " & table & " where " & indexField & "=" & indexValue
oCmdDisplay.CommandText = strSQL
oCmdDisplay.CommandType = adCmdText
rsDisplay.Open oCmdDisplay
if not rsDisplay.eof then getDisplayValue = rsDisplay(0) else getDisplayValue = null
rsDisplay.Close
else
getDisplayValue = ""
end if
oConnDisplay.Close
set rsDisplay = nothing
set oConnDisplay = nothing
set oCmdDisplay = nothing
end function
function formatName(fn, init, ln)
dim strInitial
strInitial = init
if trim(strInitial) <> "" then strInitial = strInitial & "."
formatname = fn & " " & strInitial & " " & ln
end function
sub genDropList(tablename, idfield, displayfield, whereclause, selectedValue)
dim Cmd, rs
dim strSQL
if whereclause = "" then
strSQL = "select " & idfield & "," & displayfield & " from " & tablename & " order by " & displayfield
else
strSQL = "select " & idfield & "," & displayfield & " from " & tablename & " " & whereclause & " order by " & displayfield
end if
set Cmd = Server.CreateObject("ADODB.Command")
set rs = server.createObject("ADODB.Recordset")
with Cmd
.ActiveConnection = Conn
.CommandText = strSQL
.CommandType = adCmdText
set rs = .Execute
end with
set Cmd = nothing
if selectedValue = "" then
while not rs.eof
response.write "