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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp select code and vb select code : head to head

Status
Not open for further replies.

rotschreck

Programmer
Jan 26, 2000
54
0
0
CA
www.geocities.com
HI again. I should probably change my name to Mr Impossible. *sigh* I've been inquiring about combo box that will change the values of another combo box.<br><br>So far, I've gathered examples and have tried to make them fit. As far as I can tell, they should, though, they don't.<br><br>I need the asp select boxes so that I can send the entries to the database all at once. I've tried the vb code by itself and it works. All I need is to be able to mix the 2 and I'm set.<br><br>I figure that if I can get the SelectBox function to simply post the information and allow for the auto selection, I've got it made.<br><br>____________________________________________________________<br>Page code:<br><br> &lt;td valign=&quot;top&quot;&gt;Purpose:&lt;/td&gt;<br> &lt;td valign=&quot;top&quot;&gt;<br>&lt;select name=&quot;purpose1&quot;&gt;<br> &lt;option value=&quot;&lt;%SelectBox rsPrimary, &quot;lstpurpose1&quot;, &quot;primid&quot;, &quot;primpurp&quot;, &quot;lstpurpose2&quot;, &quot;arrpurpose2&quot; %&gt;&lt;/option&gt;<br> &lt;/select&gt;<br> &lt;/td&gt;<br> &lt;td valign=&quot;top&quot; rowspan=&quot;2&quot;&gt;Request Received:&lt;br&gt; &lt;/td&gt;<br> &lt;td valign=&quot;top&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;daterec&quot; value=&quot;&lt;%=Request.Form(&quot;daterec&quot;)%&gt;&quot;&gt;&lt;/td&gt;<br> &lt;/tr&gt;<br> &lt;tr&gt;<br> &lt;td valign=&quot;top&quot;&gt;&lt;/td&gt;<br> &lt;td valign=&quot;top&quot;&gt;<br>&lt;%<br>Set objpurpose2 = Server.CreateObject(&quot;ADODB.Recordset&quot;)<br>objpurpose2.Open &quot;purpose2&quot;, Conn, 3, 3<br>%&gt;<br>&lt;select name=&quot;purpose2&quot;&gt;<br> &lt;option value=&quot;&lt;%<br>&nbsp;&nbsp;&nbsp;rsSecondary.Filter = &quot;primid = '&quot; & intFirstPub & &quot;'&quot;<br>&nbsp;&nbsp;&nbsp;SelectBox rsSecondary, &quot;lstpurpose2&quot;, &quot;secid&quot;, &quot;secpurp&quot;, &quot;&quot;, &quot; &quot; <br>&nbsp;&nbsp;&nbsp;rsSecondary.Filter = adFilterNone<br>%&gt;&lt;/option&gt;<br> &lt;/select&gt;<br>&lt;% <br>&nbsp;&nbsp;&nbsp;' Closing the connection<br>&nbsp;&nbsp;&nbsp;rsPrimary.Close<br>&nbsp;&nbsp;&nbsp;Set rsPrimary = Nothing<br>%&gt;<br><br>____________________________________________________________<br>VB Code:<br><br>SUB SelectBox(rsOptions, strName, strValue, strDisplay, strSecondary, strArray)<br>&nbsp;&nbsp;&nbsp;DIM strSelect<br>&nbsp;&nbsp;&nbsp;strSelect = vbCRLF & &quot;&lt;SELECT name=&quot; & chr(34) & strName & chr(34) & _<br>&nbsp;&nbsp; &quot; id=&quot;&nbsp;&nbsp;& chr(34) & strName & chr(34) & &quot; size=1 &quot;<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;IF strSecondary &lt;&gt; &quot;&quot; and strArray &lt;&gt; &quot;&quot; THEN<br> &nbsp;&nbsp;strSelect = strSelect & &quot; OnChange=&quot; & chr(34) & &quot;ChangeOptions('&quot; & _<br> &nbsp;&nbsp;strName & &quot;', '&quot; & strSecondary & &quot;', '&quot; & strArray & &quot;')&quot; & chr(34) & &quot;&gt;&quot; & vbCRLF<br>&nbsp;&nbsp;&nbsp;ELSE<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strSelect = strSelect & &quot;&gt;&quot; & vbCRLF<br>&nbsp;&nbsp;&nbsp;END IF<br>&nbsp;&nbsp;&nbsp;Response.Write strSelect<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;Do Until rsOptions.EOF<br> Response.Write &quot;&lt;OPTION value=&quot; & chr(34) & rsOptions.Fields(strValue) & chr(34) & &quot;&gt;&quot;<br> Response.Write Trim(rsOptions.Fields(strDisplay)) & &quot;&lt;/OPTION&gt;&quot; & vbCRLF<br> rsOptions.MoveNext<br>&nbsp;&nbsp;LOOP<br>&nbsp;&nbsp;rsOptions.MoveFirst<br>&nbsp;&nbsp;Response.Write &quot;&lt;/SELECT&gt;&quot;<br>END SUB<br><br>TIA <p> <br><a href=mailto: > </a><br><a href= Eclectic Page</a><br>
 
Your page code looks like it's including a select box within an options tag.&nbsp;&nbsp;Not sure what you're trying to do there,&nbsp;&nbsp;but I'm sure it's not that.<br> <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
*chuckle* actually, I'm sort of trying to do that.<br><br>The VB code has the &quot;dynamic list selection&quot; while the &quot;select-option&quot; asp code is required to post everything to the database later on. I'm actually trying to get the &quot;select-option&quot; to be more of a &quot;dynamic-select-option&quot;. I'm just not sure where else to proceed in this.<br><br>Ideas? <p> <br><a href=mailto: > </a><br><a href= Eclectic Page</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top