Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 25th, 2004, 06:12 AM
Registered User
 
Join Date: May 2004
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old June 16th, 2004, 06:02 PM
tnd tnd is offline
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Ie
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:04 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.