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
 Other Forums
 MS Access
 Date comparison

Author  Topic 

Rauken
Posting Yak Master

108 Posts

Posted - 2007-03-20 : 09:50:22
I'm stuck!! Short description of project. I have a table holding names of batallions and their eductional periods. Example

Name StartDate EndDate
Bat1 1/1/2008 3/30/2008
Bat2 1/1/2007 6/30/2008
Bat3 7/1/2008 12/31/2001


Now I want to search between 1/1/2008 and 12/31/2008 and see per month how many Bat are active in education. I want to create a two dimensional array with 12 months, for each month I want the number of bat active and the total amount in my search, in this example it will always be 3. Are you with me?

The reason I want it as an 2 dimensional array is that I need to write the data to an Excelfile and then create a graph based upon that.

I have began with some code, rs is a recordset holding my search.

If Not rs.EOF Then

' --- Number of rows ---
vRowCount = rs.GetRows
rowCount = UBound(vRowCount)

' --- Number of months in period ---
monthCount = DateDiff("m", startDate, endDate)

' --- Loop through each month then loop through whole recordset to check if is active
For i = 1 To monthCount
' --- Check month
' --- ????

Do While Not rs.EOF

rs.MoveNext
Loop
Next
End If


Let's say my resultset of my search is 6 rows and search is from 1/1/2008 to 12/31/2008 the result I want would look like this:

1 2 2 3 3 3 0 0 6 6 4 4
6 6 6 6 6 6 6 6 6 6 6 6

The period is 12 months, for january only 1 Bat is active in education, february 2 Bats are active and so on. Six is the total number of possible Bats.

The user's will be able to set start date and end date to what they want, for example 1/1/2008 to 6/30/2009.
Any clue how to retrieve my numbers?


Jesus saves. But Gretzky slaps in the rebound.
   

- Advertisement -