If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Date reference as criteria in query
Hi,
I'm trying to restrict a query through a date range. The query, which has against a date field the criteria "Between #date# and #date#", works fine when date is a specified value (that is, specified within the query). BUT, when date is a reference to a control on a Form, it always returns no records. Criteria I'm using is: "Between [Forms]![Main Menu]! [dFrom] And [Forms]![Main Menu]![dTo]" This always returns zero records. Is this the correct way to refer to a date on a form, or is there another way to do it? Thanks, Tim |
#2
|
|||
|
|||
Date reference as criteria in query
It is possible that the entries in the Fprm Controls are
not being recognised as dates. However, you can set the data type of the parameters. In the DesignView of the Query, use the menu Query / Parameters. In the left column, type the references to the Controls on separate rows. In the right column, select DateTime. OK to accept and try your Query again. Obviously, the Form needs to be open and there are valid date entries in the Controls for your Query to get the values. HTH Van T. Dinh MVP (Access) -----Original Message----- Hi, I'm trying to restrict a query through a date range. The query, which has against a date field the criteria "Between #date# and #date#", works fine when date is a specified value (that is, specified within the query). BUT, when date is a reference to a control on a Form, it always returns no records. Criteria I'm using is: "Between [Forms]![Main Menu]! [dFrom] And [Forms]![Main Menu]![dTo]" This always returns zero records. Is this the correct way to refer to a date on a form, or is there another way to do it? Thanks, Tim . |
Thread Tools | |
Display Modes | |
|
|