Share via


Date and Time Criteria Expressions [Access 2003 VBA Language Reference]

To specify date or time criteria for an operation, you supply a date or time value as part of the string expression that forms the criteria argument. This value must be enclosed in number signs (#).

Note  The number signs indicate to Microsoft Access that the criteria argument contains a date or time within a string.

Suppose that you are creating a filter for an Employees form to display records for all employees born on or after January 1, 1960. You could construct the criteria argument for the form's Filter or ServerFilter property as in the following example. Note the placement of the number signs.

Forms!Employees.Filter = "[BirthDate] >= #1-1-60#"

See Also | Date and Time Criteria from a Control on a Form | Domain Aggregate Functions | Multiple Fields in Criteria Expressions | Numeric Criteria Expressions | Numeric Criteria from a Control on a Form | Restrict Data to a Subset of Records | Textual Criteria Expressions | Textual Criteria from a Control on a Form