UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Date Function, Office 2007    
 
   
Kattracks
post Apr 27 2012, 02:29 PM
Post #1

UtterAccess Enthusiast
Posts: 88



Hello!

I have query that I am running on a subform. What I need to add to it however is a "DueDate" which is when my employees will be allowed to order more safety equipment. What I am trying to get to work is adding 1 year to the "DateReceived" for the item. I don't want to add an additional field for the year, since it is the same for every employee. This is my query in SQL; and I am using Access 2007!

I know how to do it if I am using two fields, but I am unsure of what it should look like when I only have the one field to use.

SELECT tblSafetyGlasses.TechnicianID, tblSafetyGlasses.Vendor, tblSafetyGlasses.Cost, tblSafetyGlasses.DateOrdered, tblSafetyGlasses.DateReceived, tblSafetyGlasses.Notes
FROM tblSafetyGlasses;


Thanks!
Kat
Go to the top of the page
 
+
DanielPineault
post Apr 27 2012, 02:41 PM
Post #2

UtterAccess VIP
Posts: 1,490



Try something along the lines of:

SELECT tblSafetyGlasses.TechnicianID, tblSafetyGlasses.Vendor, tblSafetyGlasses.Cost, tblSafetyGlasses.DateOrdered, tblSafetyGlasses.DateReceived, tblSafetyGlasses.Notes, DateAdd("yyyy",1,[DateReceived]) AS DueDate
FROM tblSafetyGlasses;
Go to the top of the page
 
+
Larry Larsen
post Apr 27 2012, 02:43 PM
Post #3

UA Editor + Utterly Certified
Posts: 22,725
From: Melton Mowbray,Leicestershire (U.K)



Hi Kat
Try:
CODE
SELECT tblSafetyGlasses.TechnicianID, tblSafetyGlasses.Vendor, tblSafetyGlasses.Cost, tblSafetyGlasses.DateOrdered, tblSafetyGlasses.DateReceived, tblSafetyGlasses.Notes, DateAdd("yyyy",1,[DateReceived]) As DueDate
FROM tblSafetyGlasses;

(IMG:style_emoticons/default/thumbup.gif)

This post has been edited by Larry Larsen: Apr 27 2012, 02:45 PM
Reason for edit: Correct Spelling....
Go to the top of the page
 
+
Kattracks
post Apr 27 2012, 02:48 PM
Post #4

UtterAccess Enthusiast
Posts: 88



That works Great! Thanks (IMG:style_emoticons/default/thumbup.gif)
Go to the top of the page
 
+
DanielPineault
post Apr 28 2012, 07:00 AM
Post #5

UtterAccess VIP
Posts: 1,490



Glad we could help! (IMG:style_emoticons/default/thumbup.gif)

DateAdd() and DateDiff are 2 very useful functions worth getting to know! Also, depending on your future needs, you may like to review and keep a copy of Doug Steele's more advanced Date Diff function that can be found at http://www.accessmvp.com/djsteele/Diff2Dates.html
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th June 2013 - 05:26 PM