Date Format

  • Thread starter Thread starter Joel
  • Start date Start date
J

Joel

Instead of this:

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

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

Thanks - Joel
 
If Year([StartDate]) = Year(Date()) Then

Note: Next year it will check if [StartDate] is in the year 2006.
 
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
(e-mail address removed)
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
 
Back
Top