Re: Setting drop-down box to database value
- From: "Thomas A. Rowe" <tarowe@xxxxxxxx>
- Date: Sun, 2 Sep 2007 11:09:27 -0400
You would have to have a recordset that loads the values into the dropdown, then you would in your
SQL Select statement exclude the default value [objrs("TotalHrs")], in you example that would be
"4". Then your list would be 0,1,2,3,5,6, now this could lead to a problem if the user make a
selection of say "5" then changes their mind, they would not be able to put back the "4".
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage
http://www.Ecom-Data.com
==============================================
"Lisa" <Lisa@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:17DB9C1A-BE5A-4593-845B-C5B83915067D@xxxxxxxxxxxxxxxx
Hi,
That sort of works, but now I have the value in the list twice, so if the
number in the db was 4, the drop-down list now is 4,0,1,2,3,4,5,6... - any
way around this??
Lisa
"Stefan B Rusynko" wrote:
Open your db/rs and get the field - say TotalHrs
Then Add it as your 1st field
<select size="1" name="Total_Hours">
<option value="<%=objrs("TotalHrs")%>"><%=objrs("TotalHrs")%></option>
<option>0</option>
......
See http://www.asp101.com/samples/db_edit.asp
--
_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________
"Lisa" <Lisa@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3E5BD3C0-AAAF-40A0-8E41-D1626948461F@xxxxxxxxxxxxxxxx
| Hi,
|
| I have an .asp page that loads a MS Access database from a form, one of the
| fields, Total_Hours is a drop-down box. Now I need an update page to allow
| the user to change the Total_Hours, so I need to set the drop-down value to
| the value stored in the database. How/where can I set this up so the field
| could be changed before saving back to the database?
|
| <select size="1" name="Total_Hours">
| <option>0</option>
| <option>1</option>
| <option>2</option>
| <option>3</option>
| <option>4</option>
| <option>5</option>
| <option>6</option>
| <option>7</option>
| <option>8</option>
| <option>9</option>
| <option>10</option>
| </select></tr>
|
| Lisa
|
.
- Follow-Ups:
- Re: Setting drop-down box to database value
- From: Lisa
- Re: Setting drop-down box to database value
- References:
- Re: Setting drop-down box to database value
- From: Stefan B Rusynko
- Re: Setting drop-down box to database value
- Prev by Date: 08'cracked software of ftp download!
- Next by Date: Links Not Working With Firefox
- Previous by thread: Re: Setting drop-down box to database value
- Next by thread: Re: Setting drop-down box to database value
- Index(es):
Relevant Pages
|