Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2006

Tip: Looking for answers? Try searching our database.

return records from some date and last 30 days

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rascal - 29 Apr 2006 14:00 GMT
Hi all:
I thought I had solved this problem, but I have discovered I haven't.  I
have a query where I want a prompt for the user to enter a date and have only
the records returned from the date entered and the previous 30 days.  I had
entered the following in the crtieria field:  >=DateAdd("d",-30,[Enter
StartDate]) but it returns records for dates afterwards. For example when I
entered Apr 13 I will also get records from Apr 14 up to today.  What have I
done wrong and how do i correct it.
Thanks for your  help.
John Spencer - 29 Apr 2006 14:18 GMT
You need to set a limit with a range.

Between DateAdd("d",-30,[Enter StartDate]) and [Enter StartDate])

That gives you a 31 day range (If you enter Dec 31 2006, the calculation returns
Dec 1 2006) so you get all records between midnight Dec 1 and midnight Dec 31.  
If your date field contains times you will need to change the above to get
records for the end date.

> Hi all:
> I thought I had solved this problem, but I have discovered I haven't.  I
[quoted text clipped - 5 lines]
> done wrong and how do i correct it.
> Thanks for your  help.
rascal - 29 Apr 2006 15:44 GMT
Thanks so much John,
I tried it out and it works the way I want it to,

> You need to set a limit with a range.
>
[quoted text clipped - 14 lines]
> > done wrong and how do i correct it.
> > Thanks for your  help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.