Applying filter (1 Viewer)

halem2

Registered User.
Local time
Today, 10:08
Joined
Nov 8, 2006
Messages
180
Hi All:

running Access 2003.

I have a form called Orders and a subform in it called Order Details. In the Order Details subform there is a yes\no field for Received items.

THE FILTER DOES NOT WORK. IT'S LIKE IS NOT EVEN THERE.

I have an unbound box and in the "On Change" Event I have the following
[forms]![Order Details]![Received].

Under Data "Row Source Type" I have Value List

on "Row Source" I have "All";"Received";"Pending"

then on the Macro side I have as follows:

macro name: Received: On Change
condition: [forms]![Order Details]![Received]="All" ----- ShowAllRecords
condition: [forms]![Order Details]![Received]="Received" - ApplyFilter
condition: [forms]![Order Details]![Received]="Pending" -- ApplyFilter

and lastly under the "Where Condition" for
Received I have [Received]=0
Pending I have [Received]=1


Any ideas?

thanks!:confused:
 

boblarson

Smeghead
Local time
Today, 07:08
Joined
Jan 12, 2001
Messages
32,059
A true is -1 not 1. To make it easier to tell what you are doing, ou should just use TRUE in the criteria as it will work.
 

halem2

Registered User.
Local time
Today, 10:08
Joined
Nov 8, 2006
Messages
180
Hi Bob:

thanks for the hint but it still does nothing. I am currently referring in the macro to the Orders form and then the field in the subform without specifying the subform name. I have tried to point it to [forms]![subfor,]![field] but it doesn't work either.

the filter dropdown is on the form and not on the subform. Would that make a difference?
 

boblarson

Smeghead
Local time
Today, 07:08
Joined
Jan 12, 2001
Messages
32,059
the filter dropdown is on the form and not on the subform. Would that make a difference?
yes, if you are trying to filter the subform from the main form you have to refer to it properly:
Code:
Me.YourSubformCONTAINERNameHere.Form.Filter = "[FieldToFilterOnHere]=" Me.YourControlToFilterOn
Me.YourSubformCONTAINERNameHere.Form.FilterOn = True
 

Stavi

New member
Local time
Today, 15:08
Joined
Aug 7, 2007
Messages
6
Bob, I know I'm a noob but to my knowledge you have to use code OR a macro, You cannot put code IN a macro

Sorry if I'm wrong but I am here trying to learn :)
 

boblarson

Smeghead
Local time
Today, 07:08
Joined
Jan 12, 2001
Messages
32,059
Bob, I know I'm a noob but to my knowledge you have to use code OR a macro, You cannot put code IN a macro

Sorry if I'm wrong but I am here trying to learn :)

Actually, with a slight modification, you can put it into a function and then call it from the macro using RunCode. But, you are correct - I didn't notice that little detail about it being tried to be done using a macro.
 

Users who are viewing this thread

Top Bottom