Hi, everyone...

I'm using ms access 2003 and i wanna know how to write a code in vba that will take initial days x add y days every end of month and store them as accumulated days.

Pleases I don't know wre to start.

Thanx in advance

Can you explain what you mean by taking days x add y days and store them as accumulated days? I'm guessing you are not trying to take, for example, an initial 45 days, add 50 days and then store 95 days. I'm guessing you are trying do to something along the lines of taking January 5, 2009 add 30 days and store February 4, 2009.

I believe what you are looking for is the DateAdd function. As an example: DateAdd("d", 30, #1/5/2009#) results in the date February 4, 2009

what I meant was that I want a code that will take the initial leave credit days x add a number of days y that will be accumulated every end of month automatically and display the number of leave day after the update every end of month.

I see... where are you having problems? There are two approaches:

1) Create a field to track the current number of leave days and at the end of each month, add a specified number of days to that number and save it in that field.
2) Create a table to track the number of leave days and then append a record to that table at the end of each month; to find out the accumulated number of days, you do a sum on all the leave days.

Can you give more details on what problem you are running in to or do you really have no idea how to do this?

To tell you the truth, is that I don't have an idea how to do it. I'll try what you've said and give you feedback on how I did it and whether it worked or not..........

Thanx again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.