Link to home
Start Free TrialLog in
Avatar of JoeSand2005
JoeSand2005

asked on

MS Access Ship Date

Hi Guys,

thanks in advance. I have a query in which I'm trying to get the latest ship date but going back 11 month. Is there any function that would allow me to get this info.

so far I've applied the mix function but I need to go back 11 month.
Thanks!

Joe

Avatar of rockiroads
rockiroads
Flag of United States of America image

dateadd("m",-11,somedate)

from somedate, it returns the date 11 months ago
Avatar of JoeSand2005
JoeSand2005

ASKER

Hey Rockiroads,

Thanks for your help. I still don't get what I'm looking for.
Note: I apply your function but doesn't work. Do you guys know why?
Here is the query I created:


SELECT Max([Orders].[Ship Date]) AS [Last Ship Date], Contacts.FirstName, Contacts.LastName, Contacts.Emails
FROM Contacts LEFT JOIN [GC-Orders] ON Contacts.ContactID = [Orders].CompanyID
GROUP BY Contacts.FirstName, Contacts.LastName, Contacts.Emails, Contacts.CompanyName
HAVING (((Max([Orders].[Ship Date]))>= dateadd("m", -11, [Ship Date]))
ORDER BY Max([Orders].[Ship Date]) DESC;
Just One Clarification companyname is not part of the query
thanks!

SELECT Max([Orders].[Ship Date]) AS [Last Ship Date], Contacts.FirstName, Contacts.LastName, Contacts.Emails
FROM Contacts LEFT JOIN [Orders] ON Contacts.ContactID = [Orders].CompanyID
GROUP BY Contacts.FirstName, Contacts.LastName, Contacts.Emails
HAVING (((Max([Orders].[Ship Date]))>= dateadd("m", -11, [Ship Date]))
ORDER BY Max([Orders].[Ship Date]) DESC;
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Rockiroads it works, eventhough I was having some problems becouse of the fact that I wanted the most recent ship date.

Thanks!