A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date reference as criteria in query



 
 
Thread Tools Display Modes
  #1  
Old June 20th, 2004, 11:39 PM
Tim Brown
external usenet poster
 
Posts: n/a
Default 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  
Old June 21st, 2004, 01:01 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:12 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.