Can I create a permanent filter by using the Form's Attribute “Filter”

jlathem

Registered User.
Local time
Today, 04:50
Joined
Jul 25, 2010
Messages
201
Can I create a permanent filter by using the Form's Attribute “Filter” so the records returned only show a specific value?

I have tried this but it didn’t work for me.

((Cash_Record.Current_Assignment=2))

Cash_Record is the table Current_Assignment is both the Table’s Field name and the Form Control name, 2 is the value I want to return.

I need to keep the records viewable as well as editable in the nice forms and not return them in Datasheets.

Is there a permanent script I can put in the form somewhere that will limit the returned records?
 
Last edited:
I would set the RecordSource property of the form to a query or query text that only shows the records you want. Maybe something like ...
Code:
SELECT * FROM CashRecord WHERE CurrentAssignment = 2
This has no bearing on whether the form is in datasheet or form view. I'm not sure what you mean here ...
and not return them in Datasheets
but a form has an AllowDatasheetView property which you can set to False.
HTH
 
That didn’t work for me.

I built a query like this:

SELECT *
FROM Cash_Record
WHERE Current_Assignment=2

I changed the Form’s Record Source to the query.

Now when I run the form I get a popup asking for Current_Assignment. I enter 2 and it returns all the records just like it did before the query.

An odd note though, if I run the form and enter number but 2 I get a blank form!



I apologize for being a confusing. I come out of the web developing (specifically ColdFusion) world and have done very little with scripting and have no experience with Access Forms!

I picked up a couple books and all the filtering examples return the sets back in Datasheet views.
 
Oh my….

Please disregard the previous posting….

I had a typo.

Your code worked for me!

Thanks for your help!

JMS
 

Users who are viewing this thread

Back
Top Bottom