Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display previous, current, next month 1

Status
Not open for further replies.

topwaya

Technical User
May 4, 2005
150
US
Hi,
I have a query that displays the ProgPlanD (program plan date) that is between a date range in a form. I would also like it to display the previous and next month program plans.

The program plan date will always be one row on the first of each month.

Here is my query:

Code:
SELECT tblProgramPlan.ProgD, tblProgramPlan.NLProg, tblProgramPlan.NLStaff, tblProgramPlan.STProg, tblProgramPlan.STStaff, tblProgramPlan.WBProg, tblProgramPlan.WBStaff
FROM tblProgramPlan
WHERE (((tblProgramPlan.ProgD) Between Forms!fdlgOps!txtStart And Forms!fdlgOps!txtEnd));

How do I also get the previous and next month to display? I found the DateAdd stuff, is that what I use? And do I put it in the WHERE statement? I can't figure out the correct syntax.

Thank you!!!
 
Something like this
Code:
WHERE (((tblProgramPlan.ProgD)) Between Dateadd("m",-1,Forms!fdlgOps!txtStart) And Dateadd("m",+1,Forms!fdlgOps!txtEnd)));
Not tested...

________________________________________________________
Zameer Abdulla
Help to find Missing people
There’s a world of difference between editorials and advertorials
 
The following works like a charm!! Thank you so much!!!

Code:
SELECT tblProgramPlan.ProgD, tblProgramPlan.NLProg, tblProgramPlan.NLStaff, tblProgramPlan.STProg, tblProgramPlan.STStaff, tblProgramPlan.WBProg, tblProgramPlan.WBStaff
FROM tblProgramPlan
WHERE (((tblProgramPlan.ProgD)) Between Dateadd("m",-1,Forms!fdlgOps!txtStart) And Dateadd("m",+1,Forms!fdlgOps!txtEnd));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top