Re: Setting drop-down box to database value

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
|





.



Relevant Pages

  • Re: include_once() within a function
    ... Mikhail Kovalev wrote: ... I've never had a PHP file take that long! ... It loads a 1,8 MB array stored as serialized in a file....=) ... A relational database would speed things up considerably. ...
    (comp.lang.php)
  • Getting a list of static objects.
    ... I have a test application that loads some data from a database. ... is then iterated a number of times, and the memory consumption of the ... stack variable is holding a reference (I use static variables heavily for ...
    (microsoft.public.dotnet.framework)
  • Re: AMD or Intel?
    ... Raid with two clusters, one for database and one for xlog. ... Loads and loads ... Are we better off getting AMD processors, ...
    (freebsd-performance)
  • PS: What i found in BOL
    ... IN BOL I found: ... > I've got a database with loads of views, which should not be changeable by ... > non-sa users. ...
    (microsoft.public.sqlserver.security)
  • Want to grant rights to Role to alter a view: Searching for Grant Alter View or something similar
    ... I've got a database with loads of views, which should not be changeable by ... non-sa users. ... exhcange the parts before and after the @ ...
    (microsoft.public.sqlserver.security)