Can't Remove Server Filter

C

CSDunn

Hello,

The following is an issue I am having with forms in an Access 2000 ADP file
that connects to a SQL Server 2000 database.

I have a form 'A' in which there is a button located in its subform 'A' that
opens another form 'B' when the subform 'A' button is clicked. The button is
designed so that form 'B' will show a single record based on a field value
from form 'A'. The name of the matching field that is present in both form
'A' and form 'B' is called 'Permnum'.

I can select record 1 in form 'A', click the button in subform 'A', and when
form 'B' opens, I get the record 1 data that I expected. The 'ServerFilter'
property in form 'B' shows [Permnum]= (record 1). It works this way until I
hit CTRL S on the keyboard while looking at the record 1 data in form 'B'.
When I do this, then go back to form 'A' and select record 2, then click the
button in subform 'A', form 'B' still shows record 1 data. If I check the
'ServerFilter' property in form 'B', it still shows [Permnum]=(record 1),
even though I selected record 2 in form 'A'.

I have tried things like 'SetValue' on the 'ServerFilter' property on
different events of form 'B', but nothing has worked. I saw the following
about 'ServerFilter' in help:

"You can only remove a server filter by using Visual Basic to set the
ServerFilterByForm property to False (0) or clear all filter criteria in the
Server Filter By Form window and then click Apply Server Filter."
So I tried this on form 'B':

Private Sub Form_Close()
Me.ServerFilterByForm = False
End Sub

But that did not work either.

What can I do to control the 'ServerFilter' property for form 'B' so that
the correct corresponding records from form 'A' will always appear, even if
the user saves form 'B'?

Thanks for your help!

CSDunn
 
N

ND

Hi,
Hitting <Ctrl><S> doesn't save the data on the form - by
hitting <Ctrl><S> you are saving the form's properties
including the current server filter value. So first
thing to do is prevent folk from saving the form's
structure when viewing it.

Open Form B in design view and view its properties. On
the "Other" tab set the "Allow Design Changes" to
read "Design View Only" instead of "All Views". Save
this design change.

Then go to the "Data" tab. On the Server Filter
property, delete where it says [Permnum]= 1. Save and
close the form.

If you now try to save the form when viewing data, the
form's structure and properties will not be saved which
means that the Server Filter property will only persist
until you close the form.
ND
 

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