Date Format

J

Joel

Instead of this:

If [StartDate] > #12/31/2004# Then

How can I say if [StartDate] is in the year 2005?

Thanks - Joel
 
P

PC Datasheet

If Year([StartDate]) = Year(Date()) Then

Note: Next year it will check if [StartDate] is in the year 2006.
 
D

Douglas J. Steele

Far more efficient to use If [StartDate] Between YearSerial(Year(Date()), 1,
1) And YearSerial(Year(Date()), 12, 31)

That way, you don't have to run a function on every row in the table and, if
StartDate is indexed, the query will use the index.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



PC Datasheet said:
If Year([StartDate]) = Year(Date()) Then

Note: Next year it will check if [StartDate] is in the year 2006.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
[email protected]
www.pcdatasheet.com



Joel said:
Instead of this:

If [StartDate] > #12/31/2004# Then

How can I say if [StartDate] is in the year 2005?

Thanks - Joel
 
Top