Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

List box syntax

Posted on 2004-10-18
3
Medium Priority
?
186 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 800 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

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 informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

783 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