QA.TechInterviews.com - your tech questions answered
Repeating Schedule In MS Access?
I'm trying to set up a data base to track my bills. I want to set bills up for a repeating schedules that can be viewed at least a good 6 months out if not infinitely.

I figure I could do this by writing a formula in Excel copying it out as far as like and importing that to Access but that would be time consuming and would have to be done periodically for each due date and pattern.

I want a formula or VBA function or procedure that will make a self updating formula with this pattern.
I'm not going to be able to write this for you at the moment but I can give you some direction. I assume that you're going to have some sort of input screen for your bills. For payments you can specify the start and end dates. In your code you can have a loop that uses the dateadd function. The code would look something like this (this is pseudo-code):

dim dEnddate as date
dim dPayDate as date

'get your dates from your form
dPaydate = txtStartdate.text
dEnddate = txtEnddate.text

Do while dPayDate <= dEnddate
<Insert record with dPayDate>
dPayDate = dateadd("month",dPayDate, 1) 'increment paydate by 1 month
Loop

You'll drop out of the loop after paydate goes past your enddate

You can also have an option to specify the # of payments.
the loop would be similar.
I'm not going to be able to write this for you at the moment but I can give you some direction. I assume that you're going to have some sort of input screen for your bills. For payments you can specify the start and end dates. In your code you can have a loop that uses the dateadd function. The code would look something like this (this is pseudo-code):

dim dEnddate as date
dim dPayDate as date

'get your dates from your form
dPaydate = txtStartdate.text
dEnddate = txtEnddate.text

Do while dPayDate <= dEnddate
<Insert record with dPayDate>
dPayDate = dateadd("month",dPayDate, 1) 'increment paydate by 1 month
Loop

You'll drop out of the loop after paydate goes past your enddate

You can also have an option to specify the # of payments.
the loop would be similar.

Back to QA. TechInterviews.com. Powered by Yahoo! Answers and TechInterviews.com community.