[AccessD] Selecting Filtered records in Datasheet
David Emerson
newsgrps at dalyn.co.nz
Sun Jun 5 22:34:48 CDT 2016
Thanks Stuart,
I was able to use Rocky's suggestion to extract the actual filter. This
will be useful because the same form prints out reports based on the
selected records - I can add the same filter to the recourdsource queries.
Regards
David
-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Stuart McLachlan
Sent: Monday, 6 June 2016 2:42 p.m.
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Selecting Filtered records in Datasheet
The key to this is the last sentence of the Help entry fro RecordsetClone:
The RecordsetClone property setting is a copy of the underlying query or
table specified by the form's RecordSource property. If a form is based on a
query, for example, referring to the RecordsetClone property is the
equivalent of cloning a Recordset object by using the same query. If you
then apply a filter to the form, the Recordset object reflects the
filtering.
--
Stuart
On 6 Jun 2016 at 12:06, Stuart McLachlan wrote:
> Couldn't find an old example, so I just knocked this up. It does what
> you want - just updates the currently displayed records.
>
> Private Sub Command8_Click()
> Dim rs As DAO.Recordset
> Set rs = Me.RecordsetClone
> rs.MoveFirst
> While Not rs.EOF
> rs.Edit
> rs!chk = True
> rs.Update
> rs.MoveNext
> Wend
>
> End Sub
>
>
> On 6 Jun 2016 at 9:46, Stuart McLachlan wrote:
>
> > Not as far as I know, but I've done a similar thing before by just
> > stepping through the filtered recordset and setting each one in
> > turn.
> > I'll see if I can dig up an example.
> >
> >
> >
> > On 6 Jun 2016 at 11:26, David Emerson wrote:
> >
> > > Hi Listers,
> > >
> > > I have a form that is displayed in Datasheet view. The records
> > > can be filtered using the built in filtering menus.
> > >
> > > I want to be able to identify the records that are showing so that
> > > I can update a field (specifically setting a yes/no field to
> > > true). Is there a property or method that will let me know which
> > > records are left when filtering is applied on a datasheet?
> > >
> > > Regards
> > >
> > > David Emerson
> > > Dalyn Software Ltd
> > > Wellington, New Zealand
More information about the AccessD
mailing list