LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Get data for only last three months


Hi Experts

I am trying to extract data for the last three months. This is m
current code. This particular code pulls the data from January to th
end of September. I would like to pull only from July to the end o
September. How do I go about modifying my code to do this?

Code
-------------------
cn.Open cString

For m = 1 To curMonth - 1

MerchantMonthly = "select branch, sum(qty), sum(b.vat)" & _
" from service_providers a left outer join cb b on a.sp_name = b.sp_name and month" & _
" (inv_date) = " & m & " and year(inv_date) = " & curYear & " order by a.sp_name"

If rs.State = -1 Then rs.Close

rs.Open MerchantMonthly, cn, adOpenKeyset, adLockOptimistic, adCmdText


'dump data into excel by calling function
Call PopulatePage(m
-------------------


I'm getting the data from SQL server.

Kind Regard

--
popp
-----------------------------------------------------------------------
poppy's Profile: http://www.excelforum.com/member.php...fo&userid=1145
View this thread: http://www.excelforum.com/showthread.php?threadid=26604

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum the data for specified months Pras Excel Discussion (Misc queries) 2 August 1st 07 08:00 PM
Transpose data Months & Data to Rows Deeds Excel Discussion (Misc queries) 18 January 8th 07 04:28 PM
I want to put 1 years data and 1 months data togheter on one char. Philippa Charts and Charting in Excel 1 February 21st 05 01:10 PM
Last Months Data!! Jeff Excel Worksheet Functions 4 December 20th 04 09:05 PM
Dates to months and calculating values for their months jigsaw2 Excel Programming 1 September 5th 03 01:35 PM


All times are GMT +1. The time now is 05:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"