Calculate Dates based on Frequency

  • Thread starter Timothy via AccessMonster.com
  • Start date
T

Timothy via AccessMonster.com

I need to create a function that will calculate the next date a call should
be made based on several argumengts:

Anchor Date (1st instance of call) - ex. 7/28/2008
Call Cycle (frequency in days should be called) - ex. 14 (should be called
every 14 days)
Todays Date

So from those 3 arguments, i need to calculate the next date a call should be
made. In the above example, I would need it to return 9/22/2008 (based on
today's date being 9/17/2008). The cycle is always a multiple of 7, and the
anchor date can be any week day typically within the last 20 years. I
thought this would be an easy build, but in practice I am coming up short.
Any guidance on this would be greatly appreciated.

Thanks

Tim
 
J

Jim Burke in Novi

Unless there's something I'm missing, I think something like this should work:

Public Function GetCallDate(byval anchorDate as date, byval cycleDays as
integer)

GetCallDate = anchorDate
While GetCallDate < date()
GetCallDate = GetCallDate + cycleDays
Wend

End Function


This assumes that todays date is an acceptable call date. If it has to be
after today then make it While callDate <= date()

There may be 'trickier' ways to do it, but I think this is probably the
easiest and most straightforward.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top