Here is what I would to calculate these values. I am not sure what you are doing with them (report or new records etc) so not sure what other code you will need:
Dim dtStart As Date
Dim dtEnd As Date
Dim iPID As Integer
Dim dtMid As Date
iPID = Me.PID
dtStart = Me.StartDate
dtEnd = Me.EndDate
'Create recordset to store data
'Post record for Start Date
rs.AddNew
rs("PID") = iPID
rs("Dates") = dtStart
rs.Update
dtMid = dtStart
Do Until dtMid >= dtEnd
dtMid = DateAdd("m", 1, dtMid)
rs.AddNew
rs("PID") = iPID
rs("Dates") = dtMid
rs.Update
Loop
rs.AddNew
rs("PID") = iPID
rs("Dates") = dtEnd
rs.Update
rs.Close
This will allow you to have n number of months each time.
I would do this instead, however:
pid,startdate and months
"111,21/1/2008,2"
Did that help?
mmcdonal
Look it up at:
http://wrox.books24x7.com