Populate Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mickster
    New Member
    • May 2006
    • 27

    Populate Field

    Hi there I am currently creating a Maintenance Form, which can change the status of an employee from Active to Inactive. However when I created the form I want their current status to be displayed.

    For instance, there is drop down box containing the name of the employee and next to it there is a drop down box with either Active or Inactive in it. So if employee named Henry Jones is selected his current status should appear in the other drop down box as either Active or Inactive

    Thanks for the help.
  • julian77
    New Member
    • May 2006
    • 5

    #2
    hi,

    this might not be the smoothest approach, but if you are using access you should be able to do the following (SQL uses bit for this datatype where true = -1 and false = 0)

    (Presumes your column name is called active and you use a request.form-statement to update your table)

    Code:
    <select name="active">
    <% if rs("active") = "True" Then %>
      <option value="true" selected>active</option>
      <option value="false">inactive</option>
    <% elseif rs("active") = "False" then %>
      <option value="true">active</option>
      <option value="false" selected>inactive</option>
    <% end if %>
      </select>
    I am not sure wheteher you need to put double quotes around True and False

    Hopefully it works ;)

    /jesper

    Comment

    • wlc04
      New Member
      • May 2006
      • 70

      #3
      Hi Mickey,

      In your table you can make the active/inactive field a combo box. If it is currently a text box, click on the lookup tab in design view of the table and change it from text box to combo box. After doing this change the row source type to value list, then put "active";"inact ive" in the row source. When you add this field to your form it will give you the combo box with your choices and the current choice will always show.

      If you need anything else, let me know. :)

      Comment

      Working...