Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2005
    Posts
    9

    Unanswered: Checking date availability

    Hi all, hope you can help me:

    Basically what im trying to do is a database which checks to see if something is available.

    The database is a booking system for services. I need the database to check a "booking" table to see if there is a booking on a specific date. If there is, then you cannot make a booking. If there isn't then you can.

    In my "booking table" there is a list of dates of bookings. Each booking lasts a week. So if someone wants to make a booking, it cant just check to see if the first day is available, it needs to check for 6 additional days. (i.e. a booking on 01 Jan 2006). If someone wants to make a booking, the database needs to account for a whole week, so the next available booking would be on 07 Jan 2006).

    How can this be done in the simplist way?

    Please bare in mind i dont know any SQL, or even where it goes.

    Thanks all.

  2. #2
    Join Date
    Jan 2006
    Posts
    14
    There is probably another way, but this is probably the easiest. I am assuming you mean that there will always be 7days between booking and could never be for example: a booking from 1/1-1/6,1/2-1/7, no over-lap only 1/1-1/6, 1/7-1/12, weekends are not an issue, etc. This will give you the next available date.

    First, create a query pulling in your booking date field only from your table. Click on the Totals button and the toolbar. Where the field is listed, go to Total and select MAX from the drop down. This will give you the last date entered as a book date. Save this query. Create another query in design view pulling in the query you just created. You do not need to bring your date filed down to the bottom. You book date should now show as maxofbook date in this query. Create and expression to calculate your next available date:
    NextAvailDte: =dateadd("D",6,[maxofbook date])
    This will take your last day booked and add six days to that date giving you the next available date. From there you can create a button in your form or something to show you the date open before you make an entry. However, if you booking are not always back to back, this is not going to work because this method will only look at the last date entered. So if someone wanted 1/1 then the next date available was 1/7 but the next one you booked wasn't until 1/15, it will only look from 1/15.
    Hope this makes sense. Maybe it can steer you in the right direction anyway.
    Last edited by adaviskheslc; 01-05-06 at 22:32. Reason: typos

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Quote Originally Posted by rsmayze01
    Please bare in mind i dont know any SQL, or even where it goes.
    Then you're basically asking us to teach grammer to someone who doesn't know english. Take a few tutorials on SQL and see how far you get. Also have a look here.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Jan 2006
    Posts
    14
    Quote Originally Posted by Teddy
    Then you're basically asking us to teach grammer to someone who doesn't know english. Take a few tutorials on SQL and see how far you get. Also have a look here.
    LOL..it's "grammar"

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I was wondering if someone would catch that...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    yeah right.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •