How to change the property of the first record in a subform based on a checkbox on a form?

M

MariahJ

Have a form with several records for ZIP codes, and a sub-form with
several carrier routes for each ZIP code. I have a checkbox for each
ZIP code that corresponds to the first carrier route (first record on
the sub-form.) I would like to change the properties of the first
record of the sub-form in some way (make it invisible, make the text
grey, etc.) if the checkbox has been selected on the form. Is this
possible?

Thanks in advance!
 
G

Guest

If you change the properties of the subform's controls this will affect all
rows in the subform. One way would be to use conditional formatting by
including a Boolean (Yes/No) field in the subform's underlying recordset and
changing the value of this to True in the first record. The controls in the
subform could then be conditionally formatted on the basis of this field's
value. As the value of the Boolean field would persist the best approach
would be to update all the rows in the subform's recordset so that the value
of the Boolean field is False, then update just the first row so its True if
the field to which the check box is bound is True. This should be done in
the parent form's Current event procedure and the check box's AfterUpdate
event procedure. You could do it either by executing two SQL statements or
by looping through the subform's recordset and updating the values row by row.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top