Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop down menu

Status
Not open for further replies.

jcpelejo

Programmer
Jul 29, 2001
70
US
Hello. I was wondering if there is a way of querying a MS Access 2000 database to populate a combo box. I have a database called claims.mdb that I pick up information from a table called [Component Codes]. Within [Component Codes], there is a field called [ComponentCode] were the information is located. The information is displayed in a combo box. Once an item is selected in the combo box, the value is saved in another table called [Junction Table] and the information from table [Component Codes], field [ComponentDescription] is displayed in a text box called [txtComponentDescription]. Please advise. Life is too short to waste...
Julius Pelejo
jcpelejo@hotmail.com
 
First of all are you asking how to populate a combo box on an asp page. The combo box will contain data from the field ComponentCodes.
And when you select a value and click a button it should populate a textbox on the page.

If that's true then it can be done. Also, it is present in this forum. Someone had asked this earlier.

If you need more information let me know.

 
Hello AgentM. Would you happen to know the article # of the last person who asked the same question? Life is too short to waste...
Julius Pelejo
jcpelejo@hotmail.com
 
I don't know the article #
But here's the code
In your ASP code :-
<%
function Fillcombo()
sSQL = &quot;SELECT ComponentCode from ComponentCodes&quot;
set rs=DBconnection.Execute(sSQL)
sOptions = &quot;&quot;
do until rs.eof
sOptions = sOptions & _
&quot;<OPTION VALUE='&quot; & rs(&quot;ComponentCode&quot;) & &quot;'> &quot;& _
&quot;rs(&quot;ComponentCode&quot;) & &quot; </OPTION>&quot;
rs.movenext
loop
Fillcombo= sOptions

end function
%>

In your html code
<form name= frm1 id=frm1 method=post action=&quot;update.asp&quot;
<SELECT name=sel1 id=sel >
<%FillCombo%>
</SELECT>
<Button ....code
</form>

You can do a method = post to update the other table.

Hope this helps
 
Hello. That script worked well. The only thing I was wondering is if when an option is chosen on the drop down box, it filters two other drop down boxes. Please advise. Life is too short to waste...
Julius Pelejo
jcpelejo@hotmail.com
 
You will have to be more clear on the filtering, do you have to connect to the database to filter the records?
 
faq333-1498

faq333-1507

[poke]
penny1.gif
penny1.gif
 
Thank you AgentM and link9 for you help. The code example and the links really helped. Life is too short to waste...
Julius Pelejo
jcpelejo@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top