Solved

ASP reservation system with Access DB - Date Range.

Posted on 2009-05-15
2
409 Views
Last Modified: 2012-05-07
I have a reservation system currently built in ASP and Access. Now im trying to build a function to check availablilty of suites on the attempt of a new booking.

For example:
Lets say someone has a reservation for May12th - 13th. If someone else comes along and tries to book May 10th - 20th it will work and overlap the other reservation.

The date range function "BETWEEN" in SQL isnt checking the individual dates of the ranges, simply the range as a whole, so A date range that is smaller and within than the one being inquired about will cause the program to overlap suite bookings.

Is there an efficient way to carry this out?

Thanks in advance.
CRSQL = "SELECT * FROM h_bookinfo WHERE (room_id=" & roomid & ") AND ((#" & checkin &"#  BETWEEN checkin_date and checkout_date AND #" & checkout &"#  BETWEEN checkin_date and checkout_date) OR (#" & checkin &"# <= checkin_date AND #" & checkout &"#  >= checkout_date))"

 

If CRLookup.EOF or CRLookup.BOF Then

		'response.write("Room is not booked")

		checkroom = false

		Else 

		'response.write("Room is booked")

		checkroom = true

		End If

Open in new window

0
Comment
Question by:nomar2
  • 2
2 Comments
 
LVL 44

Accepted Solution

by:
GRayL earned 50 total points
ID: 24398303
I'll leave it to you to get the syntax right but it goes like this:

(checkin_date Not Between checkin AND checkout) OR (checkout_date  Not Between checkin and checkout)
0
 
LVL 44

Expert Comment

by:GRayL
ID: 24495079
Thanks, glad to help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now