|
-
Jun 11th, 2001, 04:00 PM
#1
Thread Starter
Fanatic Member
Combo Boxes
I am pulling some info from an access DB. I want to put some combo boxes to build a query to sort, how would I do that?
-
Jun 11th, 2001, 04:07 PM
#2
This populates a combo box with the rows from a table. In this case the vallue of each item is the "Code" but the text displayed is from the "Desc" column.
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "select * from table1", cn
If rs.EOF Then
Else
Response.Write "<br><b>Whatever: </b> <SELECT NAME=""WhateverName"" SIZE=5 " & " >"
Do Until rs.EOF
Response.Write "<OPTION VALUE=""" & rs("Code") & _
""">" & rs("Desc") & "</OPTION>"
rs.MoveNext
Loop
Response.Write "</SELECT><br>"
End If
rs.Close
Set rs = Nothing
hope this helps.
-
Jun 11th, 2001, 04:15 PM
#3
Thread Starter
Fanatic Member
Actually what I want to do is build a query from a selection in the combo box. I am going to display a page and then have a combo box to sort more specifically...So the page loads and then you select an item in the combo box and it reloads with a modified query,...Thanks
-
Jun 11th, 2001, 04:37 PM
#4
Thread Starter
Fanatic Member
-
Sep 3rd, 2001, 02:50 AM
#5
Junior Member
This does what you want
Private Sub Command1_Click()
Dim searchstr as string
searchstr = Combo1.Text
datPrimaryRS.RecordSource = "Select name, surname, number from mytable where name = '" & searchstr & "'"
datPrimaryRS.Refresh
End Sub
You can also of course put the code into combo1_change(), or something.
The command1 button is simply a "Submit" button.
It was an electrical problem sir, a conrod went through the block, and knocked the distributer off.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|