Solved

List box syntax

Posted on 2004-10-18
3
175 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now