Looking for the best way to calculate ANY intersection between MS Access date ranges

Hi all,

I am helping out with an accomodation booking system of sorts. The schema has already been decided upon whereby one or more persons P(x) are accomodated with a particular householder H. Each householder accomodates up to P(n) persons on any one date.

The schema outline is:
--------------------------- Householder entity type -------------------------
HouseholderID Autonumber PK
Householder Text
Address Text
Accomodates Integer (the maximum number of persons that can be accomodated at any one time)
.... other Householder specific attributes.

--------------------------- Person entity type -------------------------
PersonID Autonumber PK
Firstname Text
Surname Text
.... other Householder specific attributes

--------------------------- Householder accomodates person entity relationship type -------------------------
HouseholderID  - composite PK -
PersonID           - composite PK -
StartDate Date
NumberOfDays

What I am looking for is the most efficient way to determine the availability of householders to provide accomodation, such that:

Assuming I want to accomodate a new person P(z) on a particular Date D for N days, I want to query the relationship Householder Inner Join (Householder accomodates person) Inner Join Person so that D+N does not intersect StartDate+NumberOfDays, or if it does, it returns the number of days that each householder could provide ( ranked by available days)
 
LVL 13
John Mc HaleForensic Computer Examiner, Analyst/Programmer & Database ArchitectAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
hi fredthered,
its been  a long time....

this link will get you started...

http://support.microsoft.com/Default.aspx?kbid=245074


better if you have some data available... for testing
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John Mc HaleForensic Computer Examiner, Analyst/Programmer & Database ArchitectAuthor Commented:
Hi Capicorn1,

It most certainly has been a long time. I won't say that i've been going onwards and upwards, rather shuffling sidewards. Your solution looks pretty much what I am looking for, but I will have to pass this by project owner and test same; leave with me for a couple of days.

Thanks,
fred
0
John Mc HaleForensic Computer Examiner, Analyst/Programmer & Database ArchitectAuthor Commented:
While this isn't exactly what I was looking for, it is; as you say; a good start capicorn1.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.