My Assistant
![]() ![]() |
|
|
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 |
|
|
|
Apr 27 2012, 02:41 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 1,472 |
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; |
|
|
|
Apr 27 2012, 02:43 PM
Post
#3
|
|
|
UA Editor + Utterly Certified Posts: 22,722 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....
|
|
|
|
Apr 27 2012, 02:48 PM
Post
#4
|
|
|
UtterAccess Enthusiast Posts: 88 |
That works Great! Thanks (IMG:style_emoticons/default/thumbup.gif)
|
|
|
|
Apr 28 2012, 07:00 AM
Post
#5
|
|
|
UtterAccess VIP Posts: 1,472 |
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 Top · Lo-Fi Version | Time is now: 25th May 2013 - 11:45 AM |