Alison Balteramp;#039;s Mastering Microsoft Office Access 1002003 [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Alison Balteramp;#039;s Mastering Microsoft Office Access 1002003 [Electronic resources] - نسخه متنی

Alison Balter

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید



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

Expression

Meaning

Example

Result

Date()

Current date

Date()

Records with the current date within a field.

Day(Date)

The day of a date

Day ([OrderDate])=1

Records with the order date on the first day of the month.

Month(Date)

The month of a date

Month ([OrderDate])=1

Records with the order date in January.

Year(Date)

The year of a date

Year ([OrderDate]) =2004

Records with the order date in 2004.

Weekday(Date)

The weekday of a date

Weekday ([OrderDate])=2

Records with the order date on a Monday.

Between Date And Date

A range of dates

Between #1/1/2005# and #12/31/2005#

All records in 2005.

DatePart (Interval,

A specific part of a date

DatePart ("q", Date) [OrderDate])=2

All records in the second quarter.

The Weekday(Date, [FirstDayOfWeek]) function works based on your locale and how your system defines the first day of the week. Weekday() used without the optional FirstDayOfWeek argument defaults to vbSunday as the first day. A value of 0 defaults the FirstDayOfWeek to the system definition. Other values can be set also.

Figure 4.9 illustrates the use of a date function. Notice that DatePart("q",[OrderDate]) is entered as the expression, and the value of 2 is entered for the criteria. Year([OrderDate)] is entered as another expression with the number 1997 as the criteria. Therefore, this query outputs all records in which the order date is in the second quarter of 1997.

Figure 4.9. Using the DatePart() and Year() functions in a query.



/ 544