If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Setting drop-down initial value in an update form

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-28-03, 10:40
mannix mannix is offline
Registered User
 
Join Date: Oct 2003
Posts: 2
Angry Setting drop-down initial value in an update form

I am trying to create a form that will update a record in an access database. I have successfully created the ASP pages to add the records to the database and I am working on a page to update records in the database. (Using the DRW in Frontpage)

I am using one database with two tables (virtual library). The 'Books' table contains the fields for the ID, title, publisher etc and the 'Categories' table contains a list of categories that the book may belong in and the table ID.

I have successfully added the 'categories' drop down, but the problem is that I need it to have the same initial value that the current database record has.

For instance, the field in the database called Categories was populate with 'Training' when the record was entered. When I bring up the form to edit this record I would like the drop down to be populated with 'Training' for this record. I currently have an option that shows me the first value in the table which is 'Acts'.

How do I get the form to conditionally set the initial value of the drop down list?
Reply With Quote
  #2 (permalink)  
Old 10-30-03, 11:26
itindy itindy is offline
Registered User
 
Join Date: Sep 2003
Location: United States
Posts: 1
Have you tried <%=rs("FieldName")%> for the value in the drop down box tag?
Reply With Quote
  #3 (permalink)  
Old 10-30-03, 12:18
mkkmg mkkmg is offline
Registered User
 
Join Date: Oct 2003
Location: Dallas
Posts: 76
something like this should work

<%
do connection and run query

If not RS.EOF Then
Utility = RS("utility")

End If

dbconnection.Close
%>

<form method="post" name="UpdateAppl">

<P>
<select name="S_utility" size="1" tabindex="5" >

<%if Utility = "E" then %>
<option SELECTED value="E"> Electric </option>
<%else%>
<option value="E"> Electric </option>
<%end if %>
<%if Utility = "G" then %>
<option SELECTED value="G"> Gas </option>
<%else%>
<option value="G"> Gas </option>
<%end if %>
</select>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On