Hi, I am trying to create a list from a the query that will be ran
frequently, it is supposed to show employees on the list that are have dates
between now and 30 days ago. I think that I am close with the where clause
but no quite. Please will you help me? Thanks, Misty
Ex. for today, 12/4/07, all dates between 12/4/07 and 11/5/07.
Select Date, Employee
From EmpRec
Where Date >=DateSerial(Year(Date()),Day(Date()),1) And <DateSerial(Year(Date
()),Day(Date())+1,30)
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200712/1
|
|
0
|
|
|
|
Reply
|
Mitchell_Collen
|
12/4/2007 5:22:22 PM |
|
WHERE [Date] BETWEEN DateAdd("d", -30, Date) AND Date
You should change the name of the field Date to something else. Date is an
Access reserved word and can very likely cause problems. Notice I wrapped it
in brackets, but even doing that is not always an assurance it will work
correctly.
--
Dave Hargis, Microsoft Access MVP
"Mitchell_Collen via AccessMonster.com" wrote:
> Hi, I am trying to create a list from a the query that will be ran
> frequently, it is supposed to show employees on the list that are have dates
> between now and 30 days ago. I think that I am close with the where clause
> but no quite. Please will you help me? Thanks, Misty
>
> Ex. for today, 12/4/07, all dates between 12/4/07 and 11/5/07.
>
> Select Date, Employee
> From EmpRec
> Where Date >=DateSerial(Year(Date()),Day(Date()),1) And <DateSerial(Year(Date
> ()),Day(Date())+1,30)
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200712/1
>
>
|
|
0
|
|
|
|
Reply
|
Utf
|
12/4/2007 5:35:01 PM
|
|
You're trying too hard. :-)
Between Date() - 30 and Now()
I used Now() as it will include records up to the minute.
Oh! You're field named "Date" in the EmpRec table could be a problem. Date()
is a reserved word in Access. Therefore your Date field could be getting
confused with the Date function.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
"Mitchell_Collen via AccessMonster.com" wrote:
> Hi, I am trying to create a list from a the query that will be ran
> frequently, it is supposed to show employees on the list that are have dates
> between now and 30 days ago. I think that I am close with the where clause
> but no quite. Please will you help me? Thanks, Misty
>
> Ex. for today, 12/4/07, all dates between 12/4/07 and 11/5/07.
>
> Select Date, Employee
> From EmpRec
> Where Date >=DateSerial(Year(Date()),Day(Date()),1) And <DateSerial(Year(Date
> ()),Day(Date())+1,30)
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200712/1
>
>
|
|
0
|
|
|
|
Reply
|
Utf
|
12/4/2007 5:41:02 PM
|
|
Thanks for helping me. I will try it.
Misty
Klatuu wrote:
>WHERE [Date] BETWEEN DateAdd("d", -30, Date) AND Date
>
>You should change the name of the field Date to something else. Date is an
>Access reserved word and can very likely cause problems. Notice I wrapped it
>in brackets, but even doing that is not always an assurance it will work
>correctly.
>> Hi, I am trying to create a list from a the query that will be ran
>> frequently, it is supposed to show employees on the list that are have dates
>[quoted text clipped - 7 lines]
>> Where Date >=DateSerial(Year(Date()),Day(Date()),1) And <DateSerial(Year(Date
>> ()),Day(Date())+1,30)
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200712/1
|
|
0
|
|
|
|
Reply
|
Mitchell_Collen
|
12/4/2007 6:02:29 PM
|
|
Thanks for the help!
Misty
Jerry Whittle wrote:
>You're trying too hard. :-)
>
> Between Date() - 30 and Now()
>
>I used Now() as it will include records up to the minute.
>
>Oh! You're field named "Date" in the EmpRec table could be a problem. Date()
>is a reserved word in Access. Therefore your Date field could be getting
>confused with the Date function.
>> Hi, I am trying to create a list from a the query that will be ran
>> frequently, it is supposed to show employees on the list that are have dates
>[quoted text clipped - 7 lines]
>> Where Date >=DateSerial(Year(Date()),Day(Date()),1) And <DateSerial(Year(Date
>> ()),Day(Date())+1,30)
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200712/1
|
|
0
|
|
|
|
Reply
|
Mitchell_Collen
|
12/4/2007 6:03:40 PM
|
|
|
4 Replies
1217 Views
(page loaded in 1.769 seconds)
Similiar Articles: query for Dates between today and 30 days back - microsoft.public ...Hi, I am trying to create a list from a the query that will be ran frequently, it is supposed to show employees on the list that are have dates between now and 30 ... Return a date range based on today's date - microsoft.public ...I need to build a query (to be used for eternity) to return records for dates between 01 July (the year prior) and 30 Jun (the ... or "two Thursdays from today". @day ... How do I query for a count of days since a specific date ...How do I query for a count of days since a specific date ... query for Dates between today and 30 days back - microsoft.public ... How do I query ... If before today's date insert Expired - microsoft.public ...query for Dates between today and 30 days back - microsoft.public ... Office.com To count the days before a date, you can use the TODAY ... ... add 30 days I need a ... subtracting 28 days from a date - microsoft.public.excel.worksheet ...query for Dates between today and 30 days back - microsoft.public ... For today's date (April 9, 2010 that should return Between #3/28 ... Query Day from Date field ... ... Calendar view: today and next 6 days - microsoft.public.outlook ...That's the next stage in the Conditional ... Opening calendar (month view), I want today's date on top row ... ... query for Dates between today and 30 days back ... Pick from list in query - microsoft.public.access.forms ...I am needing to select certain service requests from the query I have created from ... MAX function is not picking right date in ms access - microsoft ... Pick from list in ... IIf function, & Date(), & AND, & > & < ...I'm trying to get the query to check if an anniversary date is within the next 30 days, so I tried using ... "vanderghast" wrote: > date() include today's year, while ... Find date closest to today - microsoft.public.access.queries ...... of days between the datefield and today's date ... date) - microsoft.public.excel ... Open it back up and it should go to the row with today's date ... name query_today's date ... Query for previous week, Sun thru Sat, from date field - microsoft ...... query for distribution via macro. I could use the 'between dates ... today's date (April 9, 2010 that should return Between ... Query Sorting Days.: sql, sort, day, date ... query for Dates between today and 30 days backHi, I am trying to create a list from a the query that will be ran frequently, it is supposed to show employees on the list that are have dates query for Dates between today and 30 days back DataBaseHi, I am trying to create a list from a the query that will be ran frequently, it is supposed to show employees on the list that are have dates between now and 30 ... query for Dates between today and 30 days back - microsoft.public ...Hi, I am trying to create a list from a the query that will be ran frequently, it is supposed to show employees on the list that are have dates between now and 30 ... date - MySQL Query - Records between Today and Last 30 Days ...MySQL Query - Records between Today and Last 30 Days ... d/%Y') FROM mytable WHERE create_date BETWEEN SYSDATE() - INTERVAL 30 DAY AND ... Query Number of Days From Today in Microsoft AccessQuery Number of Days From Today in Microsoft Access. Access understands DATE() as ... we query the TDate in tblTrips for any records dated between today and 30 days ... Back to ... 7/18/2012 10:40:15 AM
|