Clear Form Filter

T

Tara

I have a form that opens via a command button and is filtered by EmployeeID.
I'd like to remove the filter when a selection is made from a combo box.
Once the filter is removed, I'd like to requery the form data.

Can that be done?

Thanks for any help.
 
M

Marshall Barton

Tara said:
I have a form that opens via a command button and is filtered by EmployeeID.
I'd like to remove the filter when a selection is made from a combo box.
Once the filter is removed, I'd like to requery the form data.


Depends on what you mean by "filtered". If it's the Filter
property, Then using
Me.FilterOn = False
should both disable the filter and requery the form.


You may or may not want to clear the Filter property too.
 
T

Tara

Thanks for getting back to me Marshall. Actually it's filterd
programatically using
the following code:

Private Sub CmdOpfrm401kG_Click()

stDocName = "frm401kGeneral"
stLinkCriteria = "[EmployeeID]=" & Me![EmployeeID]

DoCmd.OpenForm "frm401kGeneral", , , stLinkCriteria

End Sub

I'm assuming here that your solution won't work since it's coded, but I'll
go try in case I'm not understanding you. If it doesn't work, is there
another way to approach this?

Thanks for any additional advice!
 
F

fredg

Thanks for getting back to me Marshall. Actually it's filterd
programatically using
the following code:

Private Sub CmdOpfrm401kG_Click()

stDocName = "frm401kGeneral"
stLinkCriteria = "[EmployeeID]=" & Me![EmployeeID]

DoCmd.OpenForm "frm401kGeneral", , , stLinkCriteria

End Sub

I'm assuming here that your solution won't work since it's coded, but I'll
go try in case I'm not understanding you. If it doesn't work, is there
another way to approach this?

Thanks for any additional advice!

Marshall Barton said:
Depends on what you mean by "filtered". If it's the Filter
property, Then using
Me.FilterOn = False
should both disable the filter and requery the form.

You may or may not want to clear the Filter property too.

You're not being very clear (to me anyway) as to what you wish to do.
When you are opening the form using DoCmd.OpenForm the form opens
filtered by your EmployeeID field. If you look at the newly opened
form you will see the "Funnel" tool button is down.
To remove the filter, you can either click on that funnel (raising
it), or right-click on the form and select Remove Filter/Sort, or code
your Combo Box AfterUpdate event
Me.FilterOn = False.
Any of those will show all the records again.
Now for my confusion. You haven't said what it is you want done after
selecting something from the combo box (other than requery which, if
you remove the filter, is done automatically).
Show all the records (do the above), or re-filter on a new value? If
re-filter, filter on what? You don't say.
 

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