[startdate]<="date"<=[enddate] Why doesn't this work in criteria.

G

Guest

I have a data base with obvious date field. Why does this query search show
all dates and not the dates between the value of startdate and enddate?
 
G

Guest

To be honest, I'm surprised it returned anything at all. Your syntax is
wrong. You want something like:

Select * from [yourtable]
where [startdate] >= #3/23/2005#
and [enddate] <=#3/30/2005#;

Depending on how you enter in values for your startdate & enddate, you may
have to change the syntax also. This is just a quick example. If you need
more pointers, give more details.

GL
 
F

fredg

I have a data base with obvious date field. Why does this query search show
all dates and not the dates between the value of startdate and enddate?


Why don't you post the actual Where clause as well as an example of
the date entry.
 
G

Guest

Ok it would seam to be straight forward but it isn't. I am running a query
on date field and I'm trying to select dates between two values. The name
of the database is child support the name of the field is date. How would
you set up a query to select entries between two different dates?

kabaka said:
To be honest, I'm surprised it returned anything at all. Your syntax is
wrong. You want something like:

Select * from [yourtable]
where [startdate] >= #3/23/2005#
and [enddate] <=#3/30/2005#;

Depending on how you enter in values for your startdate & enddate, you may
have to change the syntax also. This is just a quick example. If you need
more pointers, give more details.

GL


Ehandau2 said:
I have a data base with obvious date field. Why does this query search show
all dates and not the dates between the value of startdate and enddate?
 
G

Guest

Ehandau2 said:
Ok it would seam to be straight forward but it isn't. I am running a query
on date field and I'm trying to select dates between two values. The name
of the database is child support the name of the field is date. How would
you set up a query to select entries between two different dates?

I'd rename the field Date. It's confusing Access; it doesn't know whether
you mean the text string "date" (four alphabetic characters), the builtin
function Date() (today's date), or the table field name.

That said, a criterion on [Date] of
= [startdate] AND <= [enddate]

should work. Your expression as written makes a certain amount of sense in
English but is NOT a valid criterion. The SQL would be

SELECT <whatever> FROM <tablename>
WHERE [date] >= [startdate] AND [date] <= [enddate];

John W. Vinson/MVP
 
V

Van T. Dinh

In the [Date] Field Column of your Query Grid, you can enter the criteria:

BETWEEN [StartDate] AND [EndDate]

When the run the Query, Access will ask for the values for the Parameters
[StartDate] and [EndDate].

In SQL view, this translates to:

.... WHERE [Date] BETWEEN [StartDate] AND [EndDate]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top