Help with Time query

purple_chicken

New member
Local time
Today, 15:31
Joined
Mar 2, 2005
Messages
7
hopefully someone can help,

I have a database where all records have a date and a time stamp.
I am trying to build a query where you enter a time parameter and the query will return all records with a timestamp of 20 mins either side of the time criteria entered.

I have the date side of thigs sorted but the time has got me stumped a bit, i tryed using timevalue but it all got a bit messy.
any help appreciated
thx
 
I'll assume that you are using a general date/time format for your fields and that you are inputting the date on a form.eg 01/01/2005 01:20:23
Form name frmdate
control name ReqDate

Then the criteria in your query will be
Between DateAdd("n",-20,[forms]![frmdate]![ReqDate]) And DateAdd("n",20,[forms]![frmdate]![ReqDate])

Brian
 
no not quite,
I have a selection form where you select thedate, the day the month and the year are selected from different drop down boxes and the date is used for referencing in a couple of different forms and querys,

in the query that im having the problem, ive got the date field, then split it down to day month and year colums using the format command, in these colums ive made the criteria reference the form so that whatever ive got selected on the form displays in the query,(still with me i hope!) the time is a seperate field, i put a enter parameter box in the criteria so that when you run the query it will select the records that match the date on the form but ask you for a time parameter. I need the query to return all records matching 20 mins either side of the time entered in the parameter box.

clear as mud i hope,
rgds
 
It's the same principle DateAdd works on a Time format field, but instead of Forms! frmname etc you will reference your parameter name

brian
 
Bingo

yeh got it thx, played around with the code you sent in a parameter columm,
thx again :)
 

Users who are viewing this thread

Back
Top Bottom