A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Todays date minus 6 days before (Shows all records in 6 days)



 
 
Thread Tools Display Modes
  #1  
Old September 14th, 2007, 09:06 AM posted to microsoft.public.access.queries
Rach
external usenet poster
 
Posts: 17
Default Todays date minus 6 days before (Shows all records in 6 days)

Im trying to write a query that says todays date (=Date()) minus 6 days. But
i want the query to show me everything from today and the 6 days before. I
have one column to add this into.

Can anyone help?

Thanks
  #2  
Old September 14th, 2007, 09:33 AM posted to microsoft.public.access.queries
Stefan Hoffmann
external usenet poster
 
Posts: 709
Default Todays date minus 6 days before (Shows all records in 6 days)

hi,

Rach wrote:
Im trying to write a query that says todays date (=Date()) minus 6 days. But
i want the query to show me everything from today and the 6 days before. I
have one column to add this into.

Just use it as criteria in your query:

SELECT *
FROM [yourTable]
WHERE [yourDatefield] = Date() - 6



mfG
-- stefan --
  #3  
Old September 14th, 2007, 12:46 PM posted to microsoft.public.access.queries
Dale Fye
external usenet poster
 
Posts: 2,651
Default Todays date minus 6 days before (Shows all records in 6 days)


Rach

I'd recommend the following:

SELECT *
From [yourTable]
WHERE [yourDateField] BETWEEN DateAdd("d", -6, date()) AND Date()

Keep in mind, if your Date field has time values in it that the above will
not actually return any values for todays date. If that is the case, replace
[yourDateField] with DateValue([yourDateField]).

HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.


"Rach" wrote:

Im trying to write a query that says todays date (=Date()) minus 6 days. But
i want the query to show me everything from today and the 6 days before. I
have one column to add this into.

Can anyone help?

Thanks

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.