Select All Button...Select all items in a subform once clicked

B

BZeyger

I have a form that has a subform. The subform contains bits of data. The
fields include Name, Address, and run. The run field is a check box. All of
the fields have a data source to the table named Issues. I would link to
place a button on the main form for the option to select all. This would
place a check in all the records.

The main form is named: Process Form
The subform is named: Process Form (subform)
Table where info is linked: Customers
check box name: chkRun
Select All Button: cmdSelectAll

I would like the user to click the cmdSelectAll button located on the main
form. Once clicked, all of the records displayed should have chkRun checked
off.

How would I do this?
 
K

Ken Sheridan

For the button's Click event procedure use:

Dim rst As DAO.Recordset
Dim frm As Form

Set frm = Me.[Process Form].Form
Set rst = frm.RecordsetClone

With rst
.MoveFirst
Do Until .EOF
.Edit
.Fields("Run") = True
.Update
.MoveNext
Loop
End With

Note that 'Process Form' is the name of the subform control, i.e. the
control in the parent form's Controls collection housing the subform,
not the name of its underlying source form object, unless both have
the same name that is.

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