Subforms/Main Form Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a dataview form with multiple rows in a subform. In one column I have
a field Called "YesorNo" in which the user is to respond either yes or no to
all when answering a question on the main form. Does anyone know how to add
a check box in the main form that when selected will answer either yes or no
to all rows in the subform for that data field? Thanks in advance for any
help offered.
 
I have a dataview form with multiple rows in a subform. In one column Ihave
a field Called "YesorNo" in which the user is to respond either yes or no to
all when answering a question on the main form. Does anyone know how toadd
a check box in the main form that when selected will answer either yes or no
to all rows in the subform for that data field? Thanks in advance for any
help offered.

I am assuming that this is merely for convenience, and that the users canstill
click yes or no on individual rows of the subform? Otherwise, I would putthat
data in the underlying table for the main form, because you can always join it
with the table containing the subform's data in a query.

Just add some code to the check box's AfterUpdate event procedure which executes
an SQL update of the subform's underlying table, then requery the subform
control's .Form object. This will also save any unsaved data in the subform.
Alternatively, you could set a recordset object in code to the Recordsetclone of
the subform's .Form object and loop through the records.
 
Bob, first thanks for responding...Second, what do mean by "recordset object
in code to the Recordsetclone of the subform's .Form object and loop through
the records"? Can you please provide me an example?
 
Bob, first thanks for responding...Second, what do mean by "recordset object
in code to the Recordsetclone of the subform's .Form object and loop through
the records"? Can you please provide me an example?

Have you ever written a VBA code procedure in Access before?
 
what do mean by "recordset object
in code to the Recordsetclone of the subform's .Form object and loop through
the records"? Can you please provide me an example?

'================================
' begin example
'================================

Dim rs as DAO.Recordset
Set rs = Me.Recordsetclone
rs.MoveFirst
Do Until rs.EOF
'...set your field value here
rs.MoveNext
Loop
rs.Close
Set rs = Nothing

'================================
' end example
'================================

In order for this to work, you also need a reference to the DAO object library
in your project. Besides, you should add some error handling.
 
Back
Top