Solved

ASP reservation system with Access DB - Date Range.

Posted on 2009-05-15
2
462 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

631 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