filter doesn't change for new search

G

Guest

I believe I know where the problem occurs, I just don't know how to correct it.

My two main tables are companies and people. All the companies have
categories.
When the Category is clicked, a form listing companies opens. When a company
is clicked, it's main form is opened. There is a command button on that form
showing a list of people. When you click on a person's name, it opens that
detail form, etc.

I believe that either the drilling down or possibly closing forms out of
order, i.e., randomly rather than the reverse order of opening keeps the
server filter's old information.

Whenever we open a company, company contact, or person in the next
transaction, the old filter remains. The only solution we have found so far
is to put the form in design mode, remove the filter, close the form and
start over.

Obviously, that is not a appropriate solution. Do you have any suggestions?
 
T

tina

sounds like you're using the .Filter property of each form that you open,
and then perhaps closing each form by clicking the "X" button in the upper
right corner, rather than closing the form with a command button. you can
1) remove the X button from your form title bars, instead providing a Close
command button on each form that utilizes the following code, as

DoCmd.Close , , acSaveNo

and/or 2) use the WHERE clause argument in each OpenForm action to filter
the recordset, rather than using the form's Filter property, as

DoCmd.OpenForm "form name here", , , "primary key fieldname = something"

the above goes all on one line. suggest you read up on the Close action, and
the OpenForm action, in VBA Help to understand how they work, and how to use
the arguments.

hth


Norma Jean said:
I believe I know where the problem occurs, I just don't know how to correct it.

My two main tables are companies and people. All the companies have
categories.
When the Category is clicked, a form listing companies opens. When a company
is clicked, it's main form is opened. There is a command button on that form
showing a list of people. When you click on a person's name, it opens that
detail form, etc.

I believe that either the drilling down or possibly closing forms out of
order, i.e., randomly rather than the reverse order of opening keeps the
server filter's old information.

Whenever we open a company, company contact, or person in the next
transaction, the old filter remains. The only solution we have found so far
is to put the form in design mode, remove the filter, close the form and
start over.

Obviously, that is not a appropriate solution. Do you have any
suggestions?
 
G

Guest

2) use the WHERE clause argument in each OpenForm action to filter
the recordset, rather than using the form's Filter property, as

DoCmd.OpenForm "form name here", , , "primary key fieldname = something"

This is the method I am using. Perhaps adding the docmd.close ... will work.
I already close using this method, but I don't address the acsave=no part.

Thank you.
 
T

tina

hmm, that seems strange to me. using the WHERE argument in an OpenForm
action applies the criteria to the form's recordset at runtime - but there
are no property settings changed, as there are when the .Filter =
"something" method is used. so even if you just close the form with the
default X button in the title bar, i don't see how it could "save" any
settings that would filter the form's recordset the next time it opens.

i'm stumped, hon, sorry.


Norma Jean said:
2) use the WHERE clause argument in each OpenForm action to filter
the recordset, rather than using the form's Filter property, as

DoCmd.OpenForm "form name here", , , "primary key fieldname = something"

This is the method I am using. Perhaps adding the docmd.close ... will work.
I already close using this method, but I don't address the acsave=no part.

Thank you.
suggestions?
 
G

Guest

When this happens and you look at the properties for the form, the server
filter always has =[fieldname].idno.

The X button is not available to the user. I did as you recommended with the
docmd.close,,acsaveno. That appears to be working. The only time it happens
is when the user keeps drilling down to perform a specific action for a
person within a company. When they only go down one or two levels, it doesn't
appear to happen.

Strange. I hope this solves it.
 
T

tina

i finally noticed that you've been using the term "server filter". Access
VBA Help says "You can use the ServerFilter property to specify a subset of
records to be displayed when a server filter is applied to a form or report
within a Microsoft Access project (.adp), or to a data access page in a
Microsoft Access project (.adp) or database (.mdb)."

so i take it that you're either working in a .adp, or working with a data
access page rather than a form. in either case, i've no experience. if
you're actually using the ServerFilter property in a .mdb form, my guess is
that you shouldn't. in any case, it seems that there *must* be some code
that is setting the property at runtime - all i can suggest is that you
thoroughly search the code in *all* the modules to see where the setting
might be coming from.

hth


Norma Jean said:
When this happens and you look at the properties for the form, the server
filter always has =[fieldname].idno.

The X button is not available to the user. I did as you recommended with the
docmd.close,,acsaveno. That appears to be working. The only time it happens
is when the user keeps drilling down to perform a specific action for a
person within a company. When they only go down one or two levels, it doesn't
appear to happen.

Strange. I hope this solves it.

tina said:
hmm, that seems strange to me. using the WHERE argument in an OpenForm
action applies the criteria to the form's recordset at runtime - but there
are no property settings changed, as there are when the .Filter =
"something" method is used. so even if you just close the form with the
default X button in the title bar, i don't see how it could "save" any
settings that would filter the form's recordset the next time it opens.

i'm stumped, hon, sorry.


that
form opens
that so
far
suggestions?
 

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