Re: query on day's transactions



On Mon, 26 Sep 2005 13:45:03 -0700, dhamric wrote:

>Let me preface this by saying that i'm not a programmer.
>
>I'm trying to setup a job that runs a query every night at 7pm that will
>pull all transactions with the date reported that equals the system date.
>What identifier would I use so that it pulled transactions based on the the
>system date? My query is below, but as you see it has a yesterday's date.
>
>select [CaseLog].[DateReported], [CaseLog].[CaseNbr]
>from [CaseLog]
>where [CaseLog].[DateReported]='2005-09-26 00:00:00'
>order by [CaseLog].[DateReported], [CaseLog].[CaseNbr]
>
>Thanks in advance

Hi dhamric,

You could use

SELECT CaseLog.DateReported, CaseLog.CaseNbr
FROM CaseLog
WHERE CaseLog.DateReported = DATEADD(day,
DATEDIFF(day, 0, getdate()), 0)
ORDER BY CaseLog.DateReported, CaseLog.CaseNbr

But if the DateReported column can be stored with a time portion other
than midnight, you should use this instead:

SELECT CaseLog.DateReported, CaseLog.CaseNbr
FROM CaseLog
WHERE CaseLog.DateReported >= DATEADD(day,
DATEDIFF(day, 0, getdate()), 0)
AND CaseLog.DateReported < DATEADD(day,
DATEDIFF(day, 0, getdate()), 1)
ORDER BY CaseLog.DateReported, CaseLog.CaseNbr


Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
.



Relevant Pages

  • Re: Data source
    ... This is really an Access query design question. ... In your Access datasource ... you need a field by which you can link each record the the Setup ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Help on Crosstab query
    ... In using the Setup table which allows the user to "close off" a year I had ... in the Column Headings of the Query properties the following which didn't ... | FROM As AP INNER JOIN qryAccountPayableItem AS API ...
    (microsoft.public.access.queries)
  • RE: Search Box
    ... created a query that would activate off of the "Search Button".... ... Private Sub cmdSearch2_click ... The query is setup so that all the fields on the form are the same from the ... person enters in johnson it lets them know they have 3. ...
    (microsoft.public.access.forms)
  • Re: DSUM non-contiguous criteria
    ... Thanks Lori for the clever setup. ... because the circular references couldn't seem to be cleared. ... table instead of the criteria table. ... My data is on one sheet and then on my separate query ...
    (microsoft.public.excel.worksheet.functions)
  • Re: DSUM non-contiguous criteria
    ... Thanks Lori for the clever setup. ... because the circular references couldn't seem to be cleared. ... table instead of the criteria table. ... My data is on one sheet and then on my separate query ...
    (microsoft.public.excel.worksheet.functions)