Wrox Programmer Forums
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 25th, 2004, 06:12 AM
Registered User
Join Date: May 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Forward booking

I hope someone can give me an idea of how to achieve the followings:
I am working on a forward booking system, the item should be able to be booked for the period it is not booked so potentially the dates could fall between 2(two) booked dates, example item is booked for 12 dec to 13 decemeber and then for 16 dec to 17 dec, then if someone wants to book for available period between 14 and 15 th, they can do that. I ll apreciate any help on the kind of SQL statement or logic.. by the way I am using VBA for excel and access .... Thanks

Old June 16th, 2004, 06:02 PM
tnd tnd is offline
Authorized User
Join Date: Jun 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts

Assuming your table stores the start and end dates in 2 seperate columns then you simply need to make sign of the difference in dates for any row is the same.
row Start End
1 1/14 1/16
2 1/21 1/25

New request 1/15 - 1/17
So you run datediff (or whatever function in access/excel)
1/14 and 1/15 = 1
1/16 and 1/15 = -1 the signs are different so 1/15 is between 1/14 and 1/16

request 1/18 - 1/19
1/14 and 1/18 = 4
1/16 and 1/18 = 2 then signs are same so 1/18 is outside of 1/14 and 1/16
1/14 and 1/19 = 5
1/16 and 1/19 = 3

As long as the sign is the same any start/end pair then the date you are checking is not in the range.
Do the same for all the previous bookings and you're all set.

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to forward some action from javascritp msg2ajay Javascript 1 September 3rd, 2007 09:08 AM
Forward after Login ~Bean~ ASP.NET 1.0 and 1.1 Basics 1 July 14th, 2005 05:14 PM
question about RequestDispatcher forward allang JSP Basics 2 June 28th, 2005 06:39 PM
Forward Booking rahilahmed Excel VBA 0 May 24th, 2004 09:25 AM
jsp:forward equivalent lpongan Beginning PHP 6 May 19th, 2004 07:17 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.