Select All Records in a subform

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

Guest

Hi,

I have a subform within a form. In that subform, I have a lot of records
that the user will be clicking the check box (to archive).

What I want to do is I want to create a button to select all the records
when the users click on the button, instead of users have to click on each
check box.

I have no problem writing codes to select all the records on the main form,
not on the subform. I think the problem is may be the reference in the
coding. Below is the coding that I use for my other main form.

Dim unArchiveEntries As Recordset
Set unArchiveEntries = Me.RecordsetClone
unArchieveEntries.MoveFirst
Do Until unArchiveEntries.EOF
Me.Bookmark = unArchiveEntries.Bookmark
If Me![Archive?] <> "No" Then
Me![Archive?] = "Yes"
End If
unArchiveEntries.MoveNext
Loop
unArchiveEntries.Close
Me.Refresh

Thanks.
 
The code will be very similar to your existing code, except that where your
existing code refers to members of the main form (Me.Whatever) you need to
refer to members of the Form property of the Subform control. For example,
where you have "Me.RecordsetClone" you need
"Me.NameOfSubformControl.Form.RecordsetClone".
 
Brendan,

Thanks for your help. It worked.

Brendan Reynolds said:
The code will be very similar to your existing code, except that where your
existing code refers to members of the main form (Me.Whatever) you need to
refer to members of the Form property of the Subform control. For example,
where you have "Me.RecordsetClone" you need
"Me.NameOfSubformControl.Form.RecordsetClone".

--
Brendan Reynolds


AccessHelp said:
Hi,

I have a subform within a form. In that subform, I have a lot of records
that the user will be clicking the check box (to archive).

What I want to do is I want to create a button to select all the records
when the users click on the button, instead of users have to click on each
check box.

I have no problem writing codes to select all the records on the main
form,
not on the subform. I think the problem is may be the reference in the
coding. Below is the coding that I use for my other main form.

Dim unArchiveEntries As Recordset
Set unArchiveEntries = Me.RecordsetClone
unArchieveEntries.MoveFirst
Do Until unArchiveEntries.EOF
Me.Bookmark = unArchiveEntries.Bookmark
If Me![Archive?] <> "No" Then
Me![Archive?] = "Yes"
End If
unArchiveEntries.MoveNext
Loop
unArchiveEntries.Close
Me.Refresh

Thanks.
 
Back
Top