ACC95: Parameter Query Excludes Ending DateLast reviewed: April 3, 1997Article ID: Q149945 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you use a Date/Time field as a parameter within a parameter query, where both valid dates and times have been stored within the Date/Time field, some of the expected records may not appear in the recordset when you type only dates (excluding time values)into the parameter box when prompted.
RESOLUTIONTo work around this behavior, enter 11:59:59pm as part of the parameter value when entering a date into the parameter box prompt, or enter the day you want plus one. For example, if you want 07/31/93, enter a date of 08/01/93 when prompted for a date. Another approach would be to create a field expression within the parameter query that would parse the time from the Date/Time field. For example:
Expr1: CVDate(Int([<DateTimeFld>]))where <DateTimeFld> would be replaced by the name of the actual Date/Time field within the table.
MORE INFORMATIONWhen you simply store a date (excluding the time) into a Date/Time field, the field will assume a default time value of 12:00:00am. If the following were entered as the query's criteria:
Between [<param1>] and [<param2>]the recordset would not include records that have a time value greater that 12:00:00am if only a date is entered into <param2>. When only a date is entered into <param2>, Microsoft Access will always assume a time value of 12:00:00am. Although many records may have a date that matches the date entered into <param2>, if the date field also stores a time value greater than 12:00:00am, that record will be excluded from the recordset.
Steps to Reproduce BehaviorThis example assumes that the sample database Northwind.mdb has not been previously altered.
|
Keywords : kbusage QryParm
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |