Need a date expression for current pay period

I am building a query to pull data for the current pay period. My pay periods run from the 1st to 15th, 16th to last day of month. Example: if today is any date between the 2nd to the 16th it would pull the data from the first pay period and if it was and date between the 17th to the 1st it would pull data from the second pay period.
Cole100IT Systems ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
What fields to you have in your table?
Dale FyeOwner, Developing Solutions LLCCommented:
SELECT * from yourTable
WHERE [DateField] >= DateSerial(Year(Date()), Month(Date()), iif(Day(Date()) < 16, 1, 16))
AND [DateField] < DateSerial(Year(Date()), Month(Date()) + iif(Day(Date()) < 16, 0, 1),
iif(Day(Date()) < 16, 16, 0))

The combination of DateSerial, plus the IIF() statements will allow you to set the values for the [DateField] criteria.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cole100IT Systems ManagerAuthor Commented:
perfect. thank you

SELECT dbo_Daily_Service_Catg_Tb.Service_Category, dbo_Daily_Service_Catg_Tb.Service_Category_Qty_Sold, dbo_Daily_Service_Catg_Tb.Service_Category_Sales_Amt
FROM dbo_Daily_Service_Catg_Tb
WHERE (((dbo_Daily_Service_Catg_Tb.Store_Number)=2881) AND ((dbo_Daily_Service_Catg_Tb.Operations_Day)>=DateSerial(Year(Date()),Month(Date()),IIf(Day(Date())<16,1,16))) AND (([dbo_Daily_Service_Catg_Tb.Operations_Day])<DateSerial(Year(Date()),Month(Date())+IIf(Day(Date())<16,0,1),IIf(Day(Date())<16,16,0))))
GROUP BY dbo_Daily_Service_Catg_Tb.Service_Category, dbo_Daily_Service_Catg_Tb.Service_Category_Qty_Sold, dbo_Daily_Service_Catg_Tb.Service_Category_Sales_Amt
HAVING (((dbo_Daily_Service_Catg_Tb.Service_Category) In ("tir","spp","brk")));

Open in new window

Dale FyeOwner, Developing Solutions LLCCommented:
glad I could help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.