
November 1st, 2007, 07:21 PM
|
|
Registered User
|
|
Join Date: Nov 2007
Posts: 3
Time spent in forums: 13 m 14 sec
Reputation Power: 0
|
|
|
Condition in where clause for default value
Hi
I have a form that takes in a year value and a month value, and feeds it back to a query which returns all transactions for that month in that year.
SELECT People.ID, People.Surname, People.[First Name], VisitHistory.Date, VisitHistory.[Amount collected], Months.Number, Months.Month, Year([Date]) AS [Year]
FROM Months, People INNER JOIN VisitHistory ON People.ID = VisitHistory.[Person ID]
WHERE (((Months.Number)=Month([Date])) AND ((Year([Date]))=[Forms]![Report menu]![Year]) AND ((Month([Date]))=[Forms]![Report menu]![Month]+1));
I want it to display all transactions for a year (i.e. all months) when no month has been selcted on the form?
How do i accompish this.
(Can one put an if statement in the where clause? - such as if no value returned back, select all)
Thanks
|