Re: Help using form filters



Possibly someone could make a useful suggestion if they knew just a little
more detail of what you have, and what you are trying to accomplish. Could
you clarify?

From whence do you determine the "affinity" or "value" for the "filter"?
"Filtering" can be accomplished in multiple ways, one of which is to create
a "WHERE clause without the WHERE" for use as the WhereCondtion argument of
a DoCmd.OpenForm statement. In many cases, however, I prefer to create the
entire SQL statement, and pass it to a newly-opened form in the OpenArgs
argument, then set it as the Form's RecordSource in the Open Event of the
Form.

Larry Linson
Microsoft Access MVP




"Jeff" <jeffrey.anderson@xxxxxxxxx> wrote in message
news:1141180057.562285.228260@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I am trying to use vb code to set the filter on a form so that only
people with a common property can see each other on a form when they
open it (like if they are in the same department). But I cannot seam to
get the filters to work correctly and most of the time I'm just getting
no records to display.

Could someone lead me onto the right path?



.



Relevant Pages

  • Re: Allen Brownes Filter - Modification troubles
    ... Access opens the query builder, so you can build the SQL statement. ... (If the RecordSource was a saved query it opens that. ... Behind the scenes, it saves this as a hidden query anyway, but it does work as a SQL statement. ... 'Build the filter string as shown in the example database. ...
    (microsoft.public.access.queries)
  • Re: Subform modifies main forms recordsource - Crash!
    ... The recordsource for the main form is a query. ... > through the querydefs and modify the sql statement accordingly. ... How are you actually applying the filter? ...
    (microsoft.public.access.formscoding)
  • Re: Form or Report ??
    ... tables into one large one as you suggest then filter on customer ID and give ... the Customer ID will this just send that customers records over the network ... > VBA code in the Report's Open event to set the report's Recordsource ...
    (microsoft.public.access.forms)
  • Re: Runtime Error 2001,when setting filter.
    ... > Allen Browne - Microsoft MVP. ... >> The filter may contain a bunch of OR's if the user was not very selective ... >>> SQL statement), and assign it to the form's RecordSource. ...
    (microsoft.public.access.formscoding)
  • Re: Automation by not storing calulated variables
    ... The Open event is too early since the records are not yet loaded, and the Load event runs once only when the recordset is loaded. ... This would work on a single form or in datasheet view, as well as on a continuous form. ... Since in its aletered state I can filter on it. ...
    (microsoft.public.access.formscoding)