Solved

List box syntax

Posted on 2004-10-18
3
178 Views
Last Modified: 2012-05-05
Hi

I have an update form that populates a number of list boxes with data from a secondary recordset. What I would like to be able to do is display the current record values from the primary recordset when the update form is first displayed rather than just seeing the list options from the seconday recordset. The user can then change the current value if they wish. Below is the code from one field. Can someone please advise me of the correct syntax.
thanks
Verdy


        <select name="Brk1" >  'from RSday
          <%
While (NOT RSBreakfast.EOF)
%>
<option value="<%=(RSBreakfast.Fields.Item("Breakfast_Item_Name").Value)%>"><%=(RSBreakfast.Fields.Item("Breakfast_Item_Name").Value)%></option>
          <%
  RSBreakfast.MoveNext()
Wend
If (RSBreakfast.CursorType > 0) Then
  RSBreakfast.MoveFirst
Else
  RSBreakfast.Requery
End If
%>
        </select>
0
Comment
Question by:verdante
3 Comments
 
LVL 7

Expert Comment

by:rohanbairat3
ID: 12343128
Sorry didnt get the question .... please explain in detail....

If its updating the values into second listbox depending on selection in first you should post back the form to itself and handle it there...

If you are more clear .. i will help u out
0
 
LVL 15

Accepted Solution

by:
gladxml earned 200 total points
ID: 12344490
I am not sure if I understood the question correctly.

assuming that your recordobject name is rs for the primary recordset which hold the
actual value and the fieldname is feild1 then this can be written as

rs("field1") which is also similar rs.Fields.Item("field1").Value

 Now to have a default value which the actual value of the primary recordset then you can try something like this

        <select name="Brk1" >  'from RSday
          <%
While (NOT RSBreakfast.EOF)
%>
<option value="<%=RSBreakfast("Breakfast_Item_Name")%>" <%if RSBreakfast("Breakfast_Item_Name") = rs("field1") then response.write "selected"%>><%=(RSBreakfast("Breakfast_Item_Name")%></option>
          <%
  RSBreakfast.MoveNext()
Wend
If (RSBreakfast.CursorType > 0) Then
  RSBreakfast.MoveFirst
Else
  RSBreakfast.Requery
End If
%>
        </select>


HTH...

Happy programming...
0
 

Author Comment

by:verdante
ID: 12346769
Love your work gladxml. It certainly did help. Very happy customer
Verdy
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Classic ASP, Search Recordset on pick list change 1 71
ASP CDO - Limiting Connections 3 59
Button to go back 3 28
Load data upon clicking a button 8 35
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question