By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,537 Members | 1,750 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,537 IT Pros & Developers. It's quick & easy.

Pass 'Filter by form' to recordsetclon

P: n/a
I have an edit button on my form that changes the recordsettype of the
form, causing the form to requery. If I have a filter applied on the
form before I hit the edit button, it is not applied to the new
recordset (which I expected). How do I pass the filter that I applied
before pressing the edit button to the new recordset?

Sep 29 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
"fonzie" <do*******@yahoo.comwrote
I have an edit button on my form that
changes the recordsettype of the form,
Do you mean the Form's RecordSource?
causing the form to requery. If I have a
filter applied on the form before I hit the
edit button, it is not applied to the new
recordset (which I expected). How do I
pass the filter that I applied before pressing
the edit button to the new recordset?
The filter is in the .Filter property of the Form. You can save it to a
Form-level variable in the Form's module and restore it to the .Filter
property, I'd think.

On the other hand, just what are you trying to accomplish with all this --
perhaps there is a simpler, easier way?

Larry Linson
Microsoft Access MVP

Sep 29 '06 #2

P: n/a
Do you mean the Form's RecordSource?

No, the recordsettype. This allows me to make edits to the records and
is working just fine.

As an exampe, if I have a form showing 1000 records and filter by
'Location', it displays 150 records. When I click the 'Edit' button on
the form, it changes the recordsettype of the form which requeries the
form and the filter is lost (because of the requery/new recordset). I
want to take the filter that was applied to the form before I clicked
the edit button and apply it to the form after the recordsetype has
been changed.

Sep 29 '06 #3

P: n/a
Do you mean the Form's RecordSource?

No, the recordsettype.

I have a form with an edit button that changes the recordsettype. When
the recordsettype is changed, the form is requeried/there is a new
recordset (which is expected.) If I apply a 'filter by form' before I
click the edit button, I want to pass that same filter to the new
recordset. Everything is working fine except that the filter does not
pass on, so I don't want to redesign my DB.

Sep 29 '06 #4

P: n/a
"fonzie" <do*******@yahoo.comwrote
>Do you mean the Form's RecordSource?

No, the recordsettype. This allows me to make edits to the records and
is working just fine.
Maybe it's even easier than what I usually do with Form properties to
accomplish the same purpose. There's always something new for me to learn in
these newsgroups.

It would have, perhaps, been clearer had you indicated _from_ and _to_ what
type you were changing it and/or why you were doing so.

As far as I know, my suggestion regarding saving the .Filter propery and
restoring it is still valid. Have you tried it, and does it accomplish what
you want?

Larry Linson
Microsoft Access MVP
Sep 29 '06 #5

P: n/a
I just got it to work, I guess I needed to type it out and read it
myself. I was saving the filter before I changed the recordsettype but
could not get it to apply afterwards. The problem was I had the line

me.recordsetclone.filter = ABC (variable name of stored filter)
me.recordsetclone.filteron = true

but I received an error. What I needed to do (and what works) is

me.recordsetclone.filter = ABC
me.filteron = true

Sep 29 '06 #6

P: n/a
"fonzie" <do*******@yahoo.comwrote in
news:11**********************@k70g2000cwa.googlegr oups.com:
I have a form with an edit button that changes the recordsettype.
Whatever for? I've never ever needed to do such a thing.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Sep 29 '06 #7

P: n/a
Whatever for? I've never ever needed to do such a thing.

The query that the form is based on is itself based on several
different tables. If you base the query on more than 2 tables, the
data becomes uneditable. I couldn't use subforms because of the need
to use 'filter by form' and include any possible combination of fields
to filter by.

I created an edit button that changes the recordsettype to 'Dynaset
(inconsistent updates)' which allows me to make any edits I need.
That's the short answer.

Sep 30 '06 #8

P: n/a
"fonzie" <do*******@yahoo.comwrote in
news:11*********************@i3g2000cwc.googlegrou ps.com:
>Whatever for? I've never ever needed to do such a thing.

The query that the form is based on is itself based on several
different tables. If you base the query on more than 2 tables,
the data becomes uneditable. I couldn't use subforms because of
the need to use 'filter by form' and include any possible
combination of fields to filter by.

I created an edit button that changes the recordsettype to
'Dynaset (inconsistent updates)' which allows me to make any edits
I need. That's the short answer.
Why not just have it be that all the time?

Or restructure your app to use an updatable query?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Sep 30 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.