We help IT Professionals succeed at work.

update record set rows with a check box

tjse7en
tjse7en asked
on
254 Views
Last Modified: 2010-08-05

Oddly enough more difficult than it looks.

I have a query string returning a key, then depending on teh key, there is a row return.  I want to have a check box and select the rows needed and teh check box will act as an open or closed period.

I've seen a few ways of doing it, but none have really been how I need it.  this is pretty straight forward - see records - see records checked - see records checked to 1 or 0 =-)

Thanks! ya'll rock!  
Comment
Watch Question

Top Expert 2004

Commented:
Name the key fields and the checkfield the same name for each type.  Then use FOR loop to update the data base.

Top Expert 2004

Commented:
Actually scratch that...you would put the key in the value of the checkbox:

Build the checkboxes:
...
Do until rs.eof
%>
Some text<INPUT type="checkbox" NAME="checks" value="<%=rs(key")%>"><br>
<%
rs.movenext
loop
....


Then when you submit the form to next page:


for each chk in request("checks")
    SQL = "UPDATE YOURTABLE SET SOMEVALUE = TRUE WHERE KEY = " & fld
    conn.execute SQL
next

Plain and simple....
Top Expert 2004

Commented:
When you name all the checkboxes the same, the ones that are checked are passed in form as Array...so you can use a FOR loop to get the value and update the related record.
Top Expert 2004
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:

Great job - that worked like a charm!!
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.