• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. What Every Developer Needs to... > Working with Dates in Criteria

Working with Dates in Criteria

Access gives you significant power for adding date functions and expressions to your query criteria. Using these criteria, you can find all records in a certain month, on a specific weekday, or between two dates. Table 4.2 lists several examples.

Table 4.2. Sample Date Criteria
ExpressionMeaningExampleResult
Date()Current dateDate()Records with the current date within a field.
Day(Date)The day of a dateDay ([OrderDate])=1Records with the order date on the first day of the month.
Month(Date)The month of a dateMonth ([OrderDate])=1Records with the order date in January.
Year(Date)The year of a dateYear ([OrderDate]) =2004Records with the order date in 2004.
Weekday(Date)The weekday of a dateWeekday ([OrderDate])=2Records with the order date on a Monday.
Between Date And DateA range of datesBetween #1/1/2005# and #12/31/2005#All records in 2005.
DatePart (Interval,A specific part of a dateDatePart ("q", Date) [OrderDate])=2All records in the second quarter.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint