If N then NEW.
If Y then...
If Y then...
If Y then Repeat.
If N then NEW.
If N then...
If Y then REPEAT.
If N then NEW.
Thats my best guess anyway...
Quote:
Good morning, Access gurus!
>
I'm having a brain fart and can't seem to wrap my head around the
logic for this problem, so I'm hoping someone out there can help me
out. Here's my situation:
>
I have a table of debts placed by clients (we're a collection agency).
tblDebts:
DebtID (autonumber pk)
ClientID (string)
ListDate (date)
ListAmt (double)
>
What I need to determine is whether a debt is considered New Business
or Repeat Business. A function that returns a boolean (e.g.
CountAsNewBiz) would be fine for my purposes. A new client placement
is either a) a placement by a client who's never placed with us
before; or b) a placement by a client who hasn't placed a debt in over
a year. We then have an activation period of 30 days in which we
count any placements as New Business. Once the 30 days expires,
placements are considered Repeat Business.
>
Here are a few examples:
ClientID 1234A places a debt on 01/15/07 for $100. They have never
placed with us before, so any placements listed between 01/15/07 and
02/14/07 should be considered as New Business.
>
ClientID 3456B places a debt on 01/15/07 for $100. The first time
this client placed with us was 12/31/02. They have been continuously
placing over the years, and last placed a debt on 01/12/07. This
placement should be considered as Repeat Business.
>
ClientID 56789C places a debt on 01/15/07 for $100. The first time
this client placed with us was 12/31/02. The last time this client
placed with us was 12/31/05, so there has been a gap of over a year.
This placement should be considered New Business.
>
ClientID 56789C now places another debt on 01/20/07 for $150. Since
01/15/07's placement was considered New Business and it's between
01/15/07 and 02/14/07, this debt is also considered New Business.
Anything placed after 02/14/07 would be Repeat Business.
>
If my explanation is unclear, please let me know.
>
Thanks in advance for your suggestions,
Jana