View Single Post
  #1  
Old June 3rd, 2010, 04:59 AM posted to microsoft.public.access.queries
PamB
external usenet poster
 
Posts: 15
Default Changing constants in a query to user input values

Access 2007
I have a table that contains (among other things)
Start Date
TimeDown
End Date
TimeUp

All of these are Date/Time type

Example data:

Start Date TimeDown End Date TimeUp
16/3/10 02:00 16/3/10 04:00
16/3/10 06:00 16/3/10 09:00
16/3/10 19:00 16/3/10 20:30
16/3/10 23:00 17/3/10 01:00
17/3/10 03:00 17/3/10 04:00
17/3/10 08:45 17/3/10 09:30

I need to be able to return only those Start Date & Time Values that occur
between 5pm on the first date and 5am on the second date. In the above
example data, this would be the 3rd, 4th and 5th lines. This is for a report
that covers Night shift.

I have a select query with constants:
Field:
NightShift: [Start Date]+[TimeDown]
Criteria:
Between #16/03/2010 5:00:00 PM# And #17/03/2010 5:00:00 AM#

and this seems to work.

What I need to be able to do is have a user input a date range (using a form
for Start Date and End Date - which I can do) but have only the time frame
5pm on the Start Date to 5am on the End Date.

I would really appreciate any assistance as I'm still muddling my way
through...

TIA

--
cheers
pamb