Storing Recurring dates in a DB

10-11-2004, 11:16 PM

I am stuck on how to do somthing in VB with an Access database.
Using JET (Access) and DAO

I am writing a program to schedule job for landscapers (A routing program)

Here is the problem i can write all the job info to the DB except i'm not sure how i should write all the recurring dates.

Job #1 on dates 10-1-2004, 10-7-2004, 10-14-2004, 10-21-2004, 10-29-2004 and so on this can go on for years.

I would appreciate any help you can give.


10-11-2004, 11:27 PM
What you'll want to do will, of course, depend on what information you are storing in your database. If you are storing individual events then what you probably want to do is something like this (pseudo code):

Get StartDate, EndDate, Frequency from user
Convert Frequency into # of days (i.e. weekly = 7, etc.)

CurrentDate = StartDate
Do while CurrentDate <= EndDate
CurrentDate = CurrentDate + days to next event

You might also want to look at using the DateAdd() ( and DateDiff() ( functions to easily allow you to deal with monthly events and leap years, etc.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum