Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 Default dates? Rate Topic Display Mode Topic Options
Author
 Message
 Posted Thursday, August 02, 2012 9:22 AM
 SSC-Enthusiastic Group: General Forum Members Last Login: Sunday, August 04, 2013 5:40 PM Points: 158, Visits: 332
 Hi, I am trying to update @start and @end date in my report with the coding logic below at report level , and the commented out are my attempt at these. I need help at 2-3 places in the IIF statement. Any ideas will be appreciated.Thank you !!`****@start***************************************************************if (todays date = first day of the current month ----Today()=DateSerial(Year(Today()), Month(Today()),1)OR todays date = second day of current month ) ----------------???then first day of last month ---=DateAdd("m", -1, DateSerial(Year(Now()), Month(Now()), 1))else first day of current month -----=DateSerial(Year(Today()), Month(Today()),1)***************@END****************************************if todays date = first day of current month ----Today()=DateSerial(Year(Today()), Month(Today()),1)OR todays date = second day of current month ---------------- ???then last day of last month --- ??? else yesterday -------=dateadd("d", -1, Today()) `
Post #1339283
 Posted Thursday, August 02, 2012 9:38 AM
 SSChampion Group: General Forum Members Last Login: Wednesday, December 04, 2013 2:23 PM Points: 10,854, Visits: 10,012
 This should answer all those questions and more. http://www.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/ _______________________________________________________________Need help? Help us help you. Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.Need to split a string? Try Jeff Moden's splitter.Cross Tabs and Pivots, Part 1 – Converting Rows to Columns Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs Understanding and Using APPLY (Part 1)Understanding and Using APPLY (Part 2)
Post #1339301
 Posted Tuesday, August 07, 2012 6:38 AM
 SSC-Enthusiastic Group: General Forum Members Last Login: Sunday, August 04, 2013 5:40 PM Points: 158, Visits: 332
 Thank you for your help !!
Post #1341195
 Posted Tuesday, August 07, 2012 7:52 AM
 SSChampion Group: General Forum Members Last Login: Wednesday, December 04, 2013 2:23 PM Points: 10,854, Visits: 10,012
 You're welcome. Hope that helped. _______________________________________________________________Need help? Help us help you. Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.Need to split a string? Try Jeff Moden's splitter.Cross Tabs and Pivots, Part 1 – Converting Rows to Columns Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs Understanding and Using APPLY (Part 1)Understanding and Using APPLY (Part 2)
Post #1341276

 Permissions