473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

SQL overlapping date

17
I have a problem with checking the overlapping date.
Basically I am developing a database using MS Access (VB scripts) and SQL queries.

I have 2 tables which are empTable and empLeaveTable.
In a form I have put all the employee data on a label. There are another text boxes that user must put in when the an emploee wants to start leave and end leave. When user click on submit button it will check wheter the empoyee already submitted a leave or not. It must check when the last time an employee submitted a leave and when is it which is stored in empLeaveTable

For example itu an emplyee already submitted a leave from 01/09/07 to 03/09/07, then submitted again on 29/09/07 to 30/09/07. Thats fine for me. However, how if then same employee want to submitted on the 16/09/07 to 19/09/07? Also when again the same employee submitted on 12/09/07 to 20/09/07? It should give the user a message that the dates are overlapping the previous date.

I have put on my code like below: However my code only check if same employee and startleave must be greater than the last date submitted by teh same employee.

ssql = "SELECT "
ssql = ssql & "tblEmployeeLeaveStatus.employee_Number, "
ssql = ssql & "tblEmployeeLeaveStatus.leave_Start, "
ssql = ssql & "tblEmployeeLeaveStatus.leave_End, "
ssql = ssql & "tblEmployeeLeaveStatus.author, "
ssql = ssql & "tblEmployeeLeaveStatus.timelog "
ssql = ssql & "FROM tblEmployeeLeaveStatus "
ssql = ssql & "WHERE ( "
ssql = ssql & "((tblEmployeeLeaveStatus.employee_Number)=" & employeeNumber & ") "
ssql = ssql & "AND "
ssql = ssql & "((tblEmployeeLeaveStatus.leave_End)>#" & format(leaveStart, "dd-MMM-YY") & "#) "
ssql = ssql & ");"

Could you help with this problem please?

Cheers
Sep 20 '07 #1
2 3821
debasisdas
8,127 Expert 4TB
As you have posted a question in the articles section it is being moved to SQL Server Forum.


MODERATOR.
Sep 20 '07 #2
monadel
17
Thx I have solved the problem. I just added up some more checking for the dates in the queries and I think they work fine
Sep 20 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Max M | last post by:
I am writing a "find-free-time" function for a calendar. There are a lot of time spans with start end times, some overlapping, some not. To find the free time spans, I first need to convert the...
0
by: Chris Q. | last post by:
I am creating a custom control that contains a list view with dates and times. I need to make sure that times do not overlap. I would like the control to determine if the overlap is occuring with the...
2
by: Chesne | last post by:
I have a table with and which are in an accommodation db. I would like to be able to determine how many days are occupied for a particular month using the two fields as per above. By adding the ...
8
by: Rsapru | last post by:
i have a table containing following data effdate termdate uid ----------- ----------- ----------- 1 2 1 3 4 2 5 8 3 7 ...
4
by: gzaxar | last post by:
Hi to all in forum. It is my first post here. I am quite new in MsAccess programming. Here is a problem which i am facing to. I want to keep records of employees CV's. More specifically i want...
4
by: Jim | last post by:
Maybe I am making this too difficult; but I have the following issue: A record contains a price for a specific Start Date and End Date. If the user adds a new price, I need to make sure the...
2
by: Durand | last post by:
I got a really annoying problem with datetime graphs. The problem is that with a long range time graph, the text on the x axis keeps overlapping like here:...
0
by: richard12345 | last post by:
Hi Guys I have problem with site I am building. The sidebar with menu and other thinks is overlapping footer. The footer move with the content and but it dos it dos not move with the sidebar. ...
2
by: manugm1987 | last post by:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <style type="text/css"><!--...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.