Need Access query help

hitsdoshi

New member
Local time
Today, 11:01
Joined
Jun 20, 2008
Messages
1
I need to display records by Month....so I designed form with combo drop down list of months and created query to display related months....I also gave option to select "ALL" in combo box, so if I select "ALL", I need to display all records......my iif query is something like this...

=IIf([Forms]![Form2]![Combo0]<13,[Forms]![Form2]![Combo0, ???]

I need something to replace this "???" and display all records is Combo0=13 (Which is referenced to ALL)

Thanks.
 
Give the value 0 to "ALL" in combo and in your query add the condition that if value of combo is zero no filter is to be applied
 
Using IIF in query criteria is a little tricky. You can set the criteria in a new column in query Design View like the following:-

---------------------------------
Field: IIf([Forms]![Form2]![Combo0]="All", True, Month([DateFieldName])=[Forms]![Form2]![Combo0])

Show: uncheck

Criteria: True
---------------------------------

See this thread for explanation:-
http://www.access-programmers.co.uk/forums/showthread.php?t=103312


But I do think comparing only the month numbers without taking into account the year will present an issue if the data in the table covers more than one year.
.
 

Users who are viewing this thread

Back
Top Bottom