drop down boxe size, no scroll bars

E

Eric Cavanaugh

Is there a way to increase the size of Drop Down boxes in an ASP
(ACCESS2000 db) so that there is no scroller bars and it maximizes to
show all selections?
 
M

MDW

There are a couple of ways to accomplish this, I'm sure. Here is one way to do it (I asume that objConn is your connection to the database and that Col1 contains the value in the select, and Col2 is what you want to display)

strSQL = "SELECT Col1, Col2 FROM Table1
Set objRS = objConn.Execute(strSQL

arrRS = objRS.GetRow
objRS.Clos
Set objRS = Nothin

intRowMax = UBound(arrRS,2
intSelSize = intRowMax + 1 ' This array is 0-base

Response.Write "<select size=" & intSelSize & ">

For I = 0 To intRowMa

Response.Write "<option value=" & arrRS(0,I) & ">" & arrRS(1,I) & "</option>

Nex

Response.Write "</select>"
 
E

Eric Cavanaugh

My code is fairly similar. But I am not sure how to incorporate yours...
Here's a chunk of my Select statement.

' Open Connection to the database
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
Select Case a
Case "C": ' Get a record to display
tkey = "" & key & ""
strsql = "SELECT * FROM [tblWeek] WHERE [ID]=" & tkey
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn
If rs.EOF Then
Response.Clear
Response.Redirect "tblWeeklist.asp"
Else
rs.MoveFirst
' Get the field contents
x_Mon = rs("Mon")
x_Tue = rs("Tue")
x_Wed = rs("Wed")
x_Thurs = rs("Thurs")
x_Fri = rs("Fri")
x_Sat = rs("Sat")
x_Sun = rs("Sun")
x_Address = rs("Address")
x_Date = rs("Date")
End If
rs.Close
Set rs = Nothing
Case "A": ' Add
'get fields from form
x_ID = Request.Form("x_ID")
x_Mon = Request.Form("x_Mon")
x_Tue = Request.Form("x_Tue")
x_Wed = Request.Form("x_Wed")
x_Thurs = Request.Form("x_Thurs")
x_Fri = Request.Form("x_Fri")
x_Sat = Request.Form("x_Sat")
x_Sun = Request.Form("x_Sun")
x_Address = Request.Form("x_Address")
x_Date = Request.Form("x_Date")
' Open record
strsql = "SELECT * FROM [tblWeek] WHERE 0 = 1"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 2
rs.AddNew
tmpFld = x_Mon
If Not IsNumeric(tmpFld) Then tmpFld = 0
rs("Mon") = cLng(tmpFld)
tmpFld = x_Tue
If Not IsNumeric(tmpFld) Then tmpFld = 0
rs("Tue") = cLng(tmpFld)
tmpFld = x_Wed
If Not IsNumeric(tmpFld) Then tmpFld = 0
rs("Wed") = cLng(tmpFld)
tmpFld = x_Thurs
If Not IsNumeric(tmpFld) Then tmpFld = 0
rs("Thurs") = cLng(tmpFld)
tmpFld = x_Fri
If Not IsNumeric(tmpFld) Then tmpFld = 0
rs("Fri") = cLng(tmpFld)
tmpFld = x_Sat
If Not IsNumeric(tmpFld) Then tmpFld = 0
rs("Sat") = cLng(tmpFld)
tmpFld = x_Sun
If Not IsNumeric(tmpFld) Then tmpFld = 0
rs("Sun") = cLng(tmpFld)
tmpFld = Trim(x_Address)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("Address") = tmpFld
tmpFld = x_Date
If IsDate(tmpFld) Then
rs("Date") = cDate(tmpFld)
Else
rs("Date") = Null
End If
rs.Update
rs.Close
Set rs = Nothing
set rs = conn.execute("SELECT max(id) FROM [tblWeek]")
maxid = rs(0)
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Response.Clear
Response.Redirect "tblWeekview.asp?key=" & maxid
End Select
%>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top