<%
' Create ADO data connection object
Set cnntypeDB = Server.CreateObject("ADODB.Connection")
' Open data connection - Use this line to use Access
cnntypeDB.Open "DBQ=" & Server.MapPath("employee_new.mdb") & ";" _
& "Driver={Microsoft Access Driver (*.mdb)};", "", ""
' Build our query for select box 1
strSQL = "SELECT * FROM Personnel WHERE Status='A' order by LastName, FirstName, MI;"
' Create and open recordset object using existing connection
Set rstequip = Server.CreateObject("ADODB.Recordset")
rstequip.Open strSQL, cnntypeDB, adOpenForwardOnly
' Build our drop down box of equip names
If Not rstequip.EOF Then
rstequip.MoveFirst
%>
<select name="RptName" tabindex="5">
<option></option>
<% ' Loop through names
Do While Not rstequip.EOF
Response.Write "<option value="""
Response.Write rstequip.Fields("LastName") & ", " & rstequip.Fields("FirstName") & " " & rstequip.Fields("MI")
Response.Write """"
Response.Write ">"
Response.Write rstequip.Fields("LastName") & ", " & rstequip.Fields("FirstName") & " " & rstequip.Fields("MI")
Response.Write "</option>" & vbCrLf
' Move to next record
rstequip.MoveNext
Loop
%>
</select>
<%
End If
' Close ADO objects we're finished with and free DB variables
rstequip.Close
Set rstequip = Nothing
cnntypeDB.Close
Set cnntypeDB = Nothing
%>
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.