Query based on time period

M

Mike Punko

OK I got a query for a date period but now I need to set the criteria to only
ask what day to search on and searches for a two given time periods
automaticlly

Criteria = Time]![From Date] And [Forms]![Time]![To Date]

Time periods to search on are
7:30 to 19:30 and 19:30 to 7:30

So if I type 2005/10/18 the queries woudl be based on

2005/10/18 7:30 to 2005/10/18 19:30
2005/10/18 19:30 to 2005/10/19 7:30
 
J

John Vinson

OK I got a query for a date period but now I need to set the criteria to only
ask what day to search on and searches for a two given time periods
automaticlly

Criteria = Time]![From Date] And [Forms]![Time]![To Date]

Time periods to search on are
7:30 to 19:30 and 19:30 to 7:30

So if I type 2005/10/18 the queries woudl be based on

2005/10/18 7:30 to 2005/10/18 19:30
2005/10/18 19:30 to 2005/10/19 7:30

I don't understand. Are these two separate queries (one for the day,
one for the night? or one query covering both time periods? If they're
separate queries, how does the user indicate which time period?

As a criterion to get just the 7:30 to 19:30 period you could use
= DateAdd("n", 450, DateValue([Enter date:])) AND <= DateAdd("n", 1140, DateValue([Enter date:]))

(450 minutes is 7-1/2 hours, 1140 is 19-1/2)

John W. Vinson[MVP]
 
K

KARL DEWEY

Do you want to distinguish day shift from night shift?

Shift: IIf([YourDate]-Int([YourDate]) Between 0.3125 And 0.8125,"Day","Night")
 
M

Mike Punko

Hey Karl i try to enter in your
Shift: IIf([YourDate]-Int([YourDate]) Between 0.3125 And 0.8125,"Day","Night")
for my criteria but I get a error "The Expresion you enter has an invalid
..(dot) or ! operator...."

KARL DEWEY said:
Do you want to distinguish day shift from night shift?

Shift: IIf([YourDate]-Int([YourDate]) Between 0.3125 And 0.8125,"Day","Night")

Mike Punko said:
OK I got a query for a date period but now I need to set the criteria to only
ask what day to search on and searches for a two given time periods
automaticlly

Criteria = Time]![From Date] And [Forms]![Time]![To Date]

Time periods to search on are
7:30 to 19:30 and 19:30 to 7:30

So if I type 2005/10/18 the queries woudl be based on

2005/10/18 7:30 to 2005/10/18 19:30
2005/10/18 19:30 to 2005/10/19 7:30
 
K

KARL DEWEY

It is not criteria but an output column based on my understanding of your
comments.

Mike Punko said:
Hey Karl i try to enter in your
Shift: IIf([YourDate]-Int([YourDate]) Between 0.3125 And 0.8125,"Day","Night")
for my criteria but I get a error "The Expresion you enter has an invalid
.(dot) or ! operator...."

KARL DEWEY said:
Do you want to distinguish day shift from night shift?

Shift: IIf([YourDate]-Int([YourDate]) Between 0.3125 And 0.8125,"Day","Night")

Mike Punko said:
OK I got a query for a date period but now I need to set the criteria to only
ask what day to search on and searches for a two given time periods
automaticlly

Criteria = Time]![From Date] And [Forms]![Time]![To Date]

Time periods to search on are
7:30 to 19:30 and 19:30 to 7:30

So if I type 2005/10/18 the queries woudl be based on

2005/10/18 7:30 to 2005/10/18 19:30
2005/10/18 19:30 to 2005/10/19 7:30
 
Top