A
aldunford
Guest
Hello. I'm trying to run a query that returnsa value by looking up a given
date in a range. The below works great however I don't want it to change
based on the year. I need it to look at the month/year and return the value
at that time. Here is my sql
SELECT [tblEmp Hire Info].*, tblNEAccruals.[Monthly Rate], [tblEmployee
Demographic Info].[Current Employee], [tblEmp Hire Info].[Hiring Status]
FROM tblNEAccruals, [tblEmployee Demographic Info] INNER JOIN [tblEmp Hire
Info] ON [tblEmployee Demographic Info].[SS# ID] = [tblEmp Hire Info].[SS# ID]
WHERE ((([tblEmployee Demographic Info].[Current Employee])=Yes) AND
(([tblEmp Hire Info].[Hiring Status])="NE") AND ((DateDiff("yyyy",[tblEmp
Hire Info].[Isac Original Hire Date],Date()))>=[tblNEAccruals].[From] And
(DateDiff("yyyy",[tblEmp Hire Info].[Isac Original Hire
Date],Date()))<[tblNEAccruals].[To]));
I did find another posting with something similar would this work for me?
Where would I put this in my above sql? Some of it is throwing me off when I
look at my own sql. Any help would be appreciated!! Thanks!!
SELECT BonnieA.DateSold, BonnieA.TermDate,
Int(DateDiff("d",[DateSold],[TermDate])/365) AS Years,
DateDiff("m",DateAdd("yyyy",Int(DateDiff("d",[DateSold],[TermDate])/365),[DateSold]),[TermDate]) AS Months
FROM BonnieA;
date in a range. The below works great however I don't want it to change
based on the year. I need it to look at the month/year and return the value
at that time. Here is my sql
SELECT [tblEmp Hire Info].*, tblNEAccruals.[Monthly Rate], [tblEmployee
Demographic Info].[Current Employee], [tblEmp Hire Info].[Hiring Status]
FROM tblNEAccruals, [tblEmployee Demographic Info] INNER JOIN [tblEmp Hire
Info] ON [tblEmployee Demographic Info].[SS# ID] = [tblEmp Hire Info].[SS# ID]
WHERE ((([tblEmployee Demographic Info].[Current Employee])=Yes) AND
(([tblEmp Hire Info].[Hiring Status])="NE") AND ((DateDiff("yyyy",[tblEmp
Hire Info].[Isac Original Hire Date],Date()))>=[tblNEAccruals].[From] And
(DateDiff("yyyy",[tblEmp Hire Info].[Isac Original Hire
Date],Date()))<[tblNEAccruals].[To]));
I did find another posting with something similar would this work for me?
Where would I put this in my above sql? Some of it is throwing me off when I
look at my own sql. Any help would be appreciated!! Thanks!!
SELECT BonnieA.DateSold, BonnieA.TermDate,
Int(DateDiff("d",[DateSold],[TermDate])/365) AS Years,
DateDiff("m",DateAdd("yyyy",Int(DateDiff("d",[DateSold],[TermDate])/365),[DateSold]),[TermDate]) AS Months
FROM BonnieA;