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.
| Author |
Topic |
|
CLiew83
Starting Member
1 Post |
Posted - 2007-02-05 : 16:44:55
|
| Hello all,I am very new to VBA, and my boss gave me a very simple assignment to do. Basically, right now the code is pulling data for forecasts for the following 10 days, and the code is the following:WHERE (((dbo_ACTUAL_HDD_DAILY.DATE)>=Now()-1 And (dbo_ACTUAL_HDD_DAILY.DATE)<Now()+9) All he wants modified is to pull data for the entire current Month (Ex. if it is in the middle of July, he would want the data from July 1-July 31, or if February from Feb 1-Feb 28) It would be nice to do this without having to change the VBA every month.Thanks for the help, I know its really simple but I hope I will get the hang of this eventually. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-05 : 16:52:16
|
| select * from yourtablewhere dailydate >= dateadd(month, datediff(month, 0, @yourdataparam), 0)and dailydate < dateadd(month, 1 + datediff(month, 0, @yourdataparam), 0)Peter LarssonHelsingborg, Sweden |
 |
|
|
vijayakumar_svk
Yak Posting Veteran
50 Posts |
Posted - 2007-02-05 : 16:55:37
|
| You can compare month with current month and year with current year. someting like the below..WHERE ((Month(dbo_ACTUAL_HDD_DAILY.DATE)=Month(Now()) And Year(dbo_ACTUAL_HDD_DAILY.DATE)=Year(Now()))Work smarter not harder take control of your life be a super achiever |
 |
|
|
|
|
|
|
|