473,398 Members | 2,393 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,398 software developers and data experts.

Time interval

1
Greeting all;

I am looking for help for the following scenario
Db with table that have three column
The first column is for Assignment title
The second & third is for Assignment period (start date\time – end date\time)
So what I need is to make sure that the time entered in th next record is not the time between any previous records.

I hope it’s clear, any help would be highly appreciated.
Apr 15 '07 #1
1 3430
ADezii
8,834 Expert 8TB
Greeting all;

I am looking for help for the following scenario
Db with table that have three column
The first column is for Assignment title
The second & third is for Assignment period (start date\time – end date\time)
So what I need is to make sure that the time entered in th next record is not the time between any previous records.

I hope it’s clear, any help would be highly appreciated.
Basic Code logic with Assumptions:
  1. Start and End are defined as Date/Time Data Types
  2. Start and End are Required Fields
  3. End Date must always be greater than the Start Date
  4. Table Name is tblAssignments
  5. Field Names on Form are txtStart and txtEnd
  6. Field Names in Table are Start and End
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2. Dim dteStartDate As Date, dteEndDate As Date, Msg As String
  3.  
  4. Msg = "The Date/Time Ranges you specified overlap the previous Record's Date/Time Range"
  5.  
  6. dteStartDate = DLast("[Start]", "tblAssignment")
  7. dteEndDate = DLast("[End]", "tblAssignment")
  8.  
  9. If IsNull(Me![txtStart]) Or IsNull(Me![txtEnd]) Then
  10.   Cancel = True: Exit Sub
  11. End If
  12.  
  13. 'Make sure there is no overlap with Time Range in previous Record
  14. If (Me![txtStart] > dteEndDate) And (Me![txtEnd] > dteStartDate) Then
  15.   'Date entries OK
  16. Else
  17.   MsgBox Msg, vbCritical, "Invalid Entry"
  18.     Cancel = True
  19. End If
  20. End Sub
Apr 15 '07 #2

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

Similar topics

2
by: Marcus | last post by:
I am having some problems with trying to perform calculations on time fields. Say I have a start time and an end time, 1:00:00 and 2:30:00 (on a 24 hour scale, not 12). I want to find the...
10
by: Andreas | last post by:
Hi! Is it possible to get a time event at a specific time, for instance eight a'clock? My program is running in the background and is minimized to the tray bar. If not, is there a smooth way...
2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
4
by: Holger Marzen | last post by:
Say, we have uptimes from several servers: Server up_from up_to ------ ------- ------- s1 0:00 8:00 s1 10:00 20:00 s1 22:00 24:00 (would better be...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
3
by: arief# | last post by:
Dear all, I'm sorry if this sounds stupid or have been talked about before. Suppose I have a field in my table that's called duration with type 'time without timezone'. How do I do sum on...
4
by: archana | last post by:
Hi all, I want to develop one windows service in which i want to provide some scheduling facility. What i want is to take start time frm one xml file and then at that specified start time. ...
2
by: dwasbig9 | last post by:
Hi Group (fairly limited knowledge of Access and almost none of Access VBA. Using Access 2003). I need to sum time, I've found through the groups archive an sql extract that led me to this ...
1
by: durai4you | last post by:
Hi IT's, Directly i'm coming to the point. I have Schedule time, Interval and current time. What i want to do is I have to start the process using schedule time and intrevel, For example The...
15
by: student4lifer | last post by:
Hello, I have 2 time fields dynamically generated in format "m/d/y H:m". Could someone show me a good function to calculate the time interval difference in minutes? I played with strtotime() but...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.