Updating Form after changing filter property

G

Guest

I have code in the form Activate event that either applies or removes a filter

Applies:

Me.Filter = criteria
Me.FilterOn = True


Removes:

Me.FilterOn = False


When the form appears after applying a filter, a record is shown that does
not meet the filter criteria and the Record Select control (leaving it there
while developing) indicates no filter active.

As soon as I use the Record Select control to advance to the next record,
the control will indicate filtered and the only records that come up in the
form meet the filter criteria.


My question is how do I programmatically get the filter to become active as
soon as the form appears?

I tried Me.Requery but that had no effect. Do I need to advance the record
to cause the filter to become active, and how do I do that> – not using ADO
with this form.

(I have 5 Access books and I can’t find what seems like a basic question!!!)

Thanks,

John
 
A

Allen Browne

The Activate event of the form is triggered whenever it gets focus. The
record could be dirty at that point, e.g. if you programmatically dirty it,
or if you were entering something, opened another form, and then switched
back. Try explicitly saving the record before applying/removing the filter:
If Me.Dirty Then Me.Dirty = False
 

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