list of months between two dates

ahmadrashid17

New member
Local time
Today, 15:22
Joined
May 29, 2007
Messages
6
i have a table which store the following informations:

StaffID - autonumber
StaffName - text (50)
EmpStartDate - date/time (general)
EmpEndDate - date/time (general)
DeptID - number, foreign key
Salary - currency
Position - text (30)


now i want to create a form for it and add a calculated control in order to get a list of month names between EmpStartDate and EmpEndDate. Is it possible, if yes, can you help me with coding. by the way i am not good in coding. i will get a course of vba and sql soon.

but for the time being. can anyone solve my question.

which control i use? and what code should i write for the control to get the rest as show in the following example.

EmpStartDate = 1/1/2006
EmpEndDate= 2/31/2007

so the result i want to get is:
jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec, jan, feb

and then how can i bring this list in the report.

thanks in advance.
 
personally I would develop a function which can be called from your query.
this function would take the two dates as parameters and return a string of months.

you require two iterative loops. The outer loop to step through the years and an inner loop to step through the months with each year.
for each month iteration concatenate the month name to the return string.

you will require to perform this twice. The firstinteration to process the months in the start year (as the month may not start at jan)

so I sugest a for next loop for the outer iteration and a do loop for the inner iteration
 
Reply:

Could anyone type the code as suggested by Danisk. i will be verythankful to him/her.
 

Users who are viewing this thread

Back
Top Bottom