Last filter value stuck in forms Server Filter property

S

Stever

I have a search form that opens a subform in datasheet view with the records
that match the criteria. The problem is, the subform sometimes retains the
last filter value in the server filter properties of the subform. I tried
forcing this to clear by putting me.serverfilter ="" in the subforms' On
Close event but that had no effect.

Below is the code I use to open the subform. Any ideas why this is happening
or how to fix it?

Thanks in advance for your suggestions

Steve

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "sfrmCivil_SearchResults"

stLinkCriteria = "[Proj_No] = '" & Me![cmdFindProjNumbers] & "'"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
 
T

Ted Allen

Hi Steve,

I think that you can prevent filter changes (and other
changes) from being saved with a form in view mode by
changing the "Allow Design Changes" property to "Design
View Only".

HTH, Ted Allen
 
S

Stever

That didn't fix it. Bummer!

Ted Allen said:
Hi Steve,

I think that you can prevent filter changes (and other
changes) from being saved with a form in view mode by
changing the "Allow Design Changes" property to "Design
View Only".

HTH, Ted Allen
-----Original Message-----
I have a search form that opens a subform in datasheet view with the records
that match the criteria. The problem is, the subform sometimes retains the
last filter value in the server filter properties of the subform. I tried
forcing this to clear by putting me.serverfilter ="" in the subforms' On
Close event but that had no effect.

Below is the code I use to open the subform. Any ideas why this is happening
or how to fix it?

Thanks in advance for your suggestions

Steve

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "sfrmCivil_SearchResults"

stLinkCriteria = "[Proj_No] = '" & Me! [cmdFindProjNumbers] & "'"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria


.
 
T

Ted Allen

That's weird. I would have thought this would prevent
filter changes from being saved with the form. Did you
for sure make the change to the subform and not the main
form? Also, when you made the change, did you check the
filter property in design view to make sure it was
cleared to start with?

If so, and if that solution isn't working, you could try
resetting the subform's filter property on open, rather
than trying to modify it on close. You should be able to
do this by typing

Me.filter = ""

in the subform's On Open event.

Hopefully one of the above suggestions will help.

-Ted Allen
-----Original Message-----
That didn't fix it. Bummer!

Hi Steve,

I think that you can prevent filter changes (and other
changes) from being saved with a form in view mode by
changing the "Allow Design Changes" property to "Design
View Only".

HTH, Ted Allen
-----Original Message-----
I have a search form that opens a subform in datasheet view with the records
that match the criteria. The problem is, the subform sometimes retains the
last filter value in the server filter properties of
the
subform. I tried
forcing this to clear by putting me.serverfilter =""
in
the subforms' On
Close event but that had no effect.

Below is the code I use to open the subform. Any ideas why this is happening
or how to fix it?

Thanks in advance for your suggestions

Steve

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "sfrmCivil_SearchResults"

stLinkCriteria = "[Proj_No] = '" & Me! [cmdFindProjNumbers] & "'"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria


.


.
 

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