Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql vba date pass

Author  Topic 

hameedf
Starting Member

27 Posts

Posted - 2012-07-05 : 01:21:46
Hello Experts !

I need some help iam getting the data to excel sheet via vba/sql. Iam stuck suppose my enddate is "11/30/2010" i need to go forward one month from this dates to get the data on sheet. Iam passing date parameter like below but for passing this parameter i get the date on sheet till "12/2/2011" i need every end date of the month?

dEnddate01 = CDate(DateAdd("d", 1, DateValue(Str(Month(dEnddate) + 1) + "-1-" + Str(Year(dEnddate)))))


Thanks
hamdf

Hameed

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-05 : 01:37:59
are you looking for sql or vba code?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

hameedf
Starting Member

27 Posts

Posted - 2012-07-05 : 01:45:29
Visakh16,

I write some sql queries and want to pass date paramter to it all work fine just i need some amendent in this syntax that goes every end of the month?

Iam sorry if not understand well.



Hameed
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-05 : 10:00:08
if you want date to become date 2 of next month isnt it enough to add 2 days always?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -