Date criteria

C

Chi

Hi,

I have two fields: StartDate and EndDate. I would like my qry to pull out
all students who are at my class between StarDate and EndDate that I supply
as parameter.

Ex:
StartDate EndDate
Student 1 01/15/07 12/15/07
Student2 02/16/07 05/01/08
Student3 04/01/06 04/01/07
Student4 01/01/06 01/14/07

If I enter StartDate: 01/15/07 and EndDate: 12/15/07, I would like to have
student1 , student 2 and student 3 since either their StartDate or EndDate
fall between these dates ( between 01/15/07 and 12/15/07), but not student 4
since his StartDate and EndDate is not between 01/15/07 and 12/15/07.

Would you please help me on the criteria?

Thanks
Chi
 
O

Ofer Cohen

Try something like

Select * From TableName Where
StartDate Between [Please enter start date] And [Please enter end date]
Or EndDate Between [Please enter start date] And [Please enter end date]

The same criteria under each of the date fields with Or
 
C

Chi

Hi Ofer,

Would you please tell me more detail. Sorry, I don't know where " * From
TableName Where .........." is.

Thanks
Chi
Ofer Cohen said:
Try something like

Select * From TableName Where
StartDate Between [Please enter start date] And [Please enter end date]
Or EndDate Between [Please enter start date] And [Please enter end date]

The same criteria under each of the date fields with Or
--
Good Luck
BS"D


Chi said:
Hi,

I have two fields: StartDate and EndDate. I would like my qry to pull out
all students who are at my class between StarDate and EndDate that I supply
as parameter.

Ex:
StartDate EndDate
Student 1 01/15/07 12/15/07
Student2 02/16/07 05/01/08
Student3 04/01/06 04/01/07
Student4 01/01/06 01/14/07

If I enter StartDate: 01/15/07 and EndDate: 12/15/07, I would like to have
student1 , student 2 and student 3 since either their StartDate or EndDate
fall between these dates ( between 01/15/07 and 12/15/07), but not student 4
since his StartDate and EndDate is not between 01/15/07 and 12/15/07.

Would you please help me on the criteria?

Thanks
Chi
 
K

KARL DEWEY

It is a SQL statement. Open query in design view, click on menu VIEW - SQL
View and it opens another window to display the SQL language of the query.
SELECT * ---- select all field of the table.
FROM TableName --- tells the query the source of data - table, query, etc.
WHERE --- states the criteria of the query.
StartDate Between [Please enter start date] And [Please enter end date]
Or EndDate Between [Please enter start date] And [Please enter end date]

--
KARL DEWEY
Build a little - Test a little


Chi said:
Hi Ofer,

Would you please tell me more detail. Sorry, I don't know where " * From
TableName Where .........." is.

Thanks
Chi
Ofer Cohen said:
Try something like

Select * From TableName Where
StartDate Between [Please enter start date] And [Please enter end date]
Or EndDate Between [Please enter start date] And [Please enter end date]

The same criteria under each of the date fields with Or
--
Good Luck
BS"D


Chi said:
Hi,

I have two fields: StartDate and EndDate. I would like my qry to pull out
all students who are at my class between StarDate and EndDate that I supply
as parameter.

Ex:
StartDate EndDate
Student 1 01/15/07 12/15/07
Student2 02/16/07 05/01/08
Student3 04/01/06 04/01/07
Student4 01/01/06 01/14/07

If I enter StartDate: 01/15/07 and EndDate: 12/15/07, I would like to have
student1 , student 2 and student 3 since either their StartDate or EndDate
fall between these dates ( between 01/15/07 and 12/15/07), but not student 4
since his StartDate and EndDate is not between 01/15/07 and 12/15/07.

Would you please help me on the criteria?

Thanks
Chi
 
C

Chi

Good morning Karl,

I appreciate for your explanation. It is very helpful!!!!!!!!!!
Chi

KARL DEWEY said:
It is a SQL statement. Open query in design view, click on menu VIEW - SQL
View and it opens another window to display the SQL language of the query.
SELECT * ---- select all field of the table.
FROM TableName --- tells the query the source of data - table, query, etc.
WHERE --- states the criteria of the query.
StartDate Between [Please enter start date] And [Please enter end date]
Or EndDate Between [Please enter start date] And [Please enter end date]

--
KARL DEWEY
Build a little - Test a little


Chi said:
Hi Ofer,

Would you please tell me more detail. Sorry, I don't know where " * From
TableName Where .........." is.

Thanks
Chi
Ofer Cohen said:
Try something like

Select * From TableName Where
StartDate Between [Please enter start date] And [Please enter end date]
Or EndDate Between [Please enter start date] And [Please enter end date]

The same criteria under each of the date fields with Or
--
Good Luck
BS"D


:

Hi,

I have two fields: StartDate and EndDate. I would like my qry to pull out
all students who are at my class between StarDate and EndDate that I supply
as parameter.

Ex:
StartDate EndDate
Student 1 01/15/07 12/15/07
Student2 02/16/07 05/01/08
Student3 04/01/06 04/01/07
Student4 01/01/06 01/14/07

If I enter StartDate: 01/15/07 and EndDate: 12/15/07, I would like to have
student1 , student 2 and student 3 since either their StartDate or EndDate
fall between these dates ( between 01/15/07 and 12/15/07), but not student 4
since his StartDate and EndDate is not between 01/15/07 and 12/15/07.

Would you please help me on the criteria?

Thanks
Chi
 

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