Link to home
Start Free TrialLog in
Avatar of ksilvoso
ksilvosoFlag for United States of America

asked on

Remove filter from Access form but stay on current record

I have an Access form that I would like to allow people to filter using the built in filter by selection.  My form is set up so that the grants table is the subform of the applicant form.  The built in filter works fine when I apply it but when the filter is removed the form jumps to the first record in the applicants table.  I would like it to stay on the current record.  I have already set the properties of all forms to current record but for some reason, removing the filter seems to bypass this.
Thanks,
Karen
Avatar of ksilvoso
ksilvoso
Flag of United States of America image

ASKER

I forgot to mention I am applying the filter to a field in the subform.
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found your solution quickly with a search.  It is exactly what I was looking for.
 I tried the code and recieved the error "Method or Data Member not found".  The code stops on .ID in the =Me.ID declaration.  
Cheers
Allen
PS: if another user butts in to the Ask side of the question, do you get extra points for solving that query? :)
That said, I think that the Asker could benefit from that information as well, and that is good information to have in this thread.

ID is a generic fieldname I used to represent the Primary Key or other "defining" field for that form's recordsource. You would have to replace ID with whatever fieldname you have given your primary key (for example, employeeID).
I changed:   varFilterID = Me.ID   to:
  varFilterOrderID = Me!OrderID  (don't forget the "bang" "!" !)
I also changed all the instances of ID to my field OrderID
It worked!
Thanks
Allen
soooo....
Allen -

<soooo.... >

Not much more to do here - you can't "Accept" an answer or award points on someone else's question ;-)

No word here from the OP, so the question may have been abandoned.


<It worked!>

I'm glad this helped you out on your own project.

Things work out in strange ways sometimes :-)


mb
mb
I don't know what happened. This is your solution.  I simply added the clarification and pointed out the missing bang to be helpful :)
Cheers
Allen
Allen,

Understood :-)