DotDragnet
May 23, 2012, 09:46:45 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Mobile users - Our forum is Tapatalk enabled. http://www.tapatalk.com/
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Access date  (Read 471 times)
Shirker
Hero Member
*****
Posts: 1625



View Profile WWW Awards
« on: October 26, 2010, 03:27:40 PM »

I'm trying to tech myself Access 2010 as we need to get a better system for controlling mountains of health data the existing system is creaking now. I want to do a query which says sort all the people who have a test coming due within the next six months of today's date. Anyone know what the format for that would be? Something using =date () plus some time period?

Ta muchly.

Logged

samhs
Administrator
Hero Member
*****
Posts: 1713



View Profile WWW Awards
« Reply #1 on: October 26, 2010, 06:47:56 PM »

select * from yourtable where datediff('d',now(),renewaldate)<184 order by renewaldate

That assumes you have a datetime column called renewaldate, and that your table is called yourtable, and that you're willing to accept 183 days as an approximation of 6 months.

hth
Logged

Loose adj a not held together; not fastened or firmly fixed in place
Lose verb to misplace something. To fail to keep or obtain something, especially because of a mistake, carelessness, etc.
---
Blog: www.ohwrite.co.uk
Twitter: www.twitter.com/samhs
Shirker
Hero Member
*****
Posts: 1625



View Profile WWW Awards
« Reply #2 on: October 27, 2010, 09:13:59 AM »

Thanks Sam smile
Logged

Rosco
Global Moderator
Hero Member
*****
Posts: 917



View Profile Awards
« Reply #3 on: October 28, 2010, 04:02:33 PM »

I think datedif() also takes 'm' (for month) as an argument, so you could be more exact in months
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!