Thread: Time Difference before and after
02-26-16, 08:33 #1Registered User
- Join Date
- Feb 2013
Unanswered: Time Difference before and after
Good Afternoon All,
Would anyone be able to suggest a solution to the following issue.
I have created a button which is designed as a check call button which enters data into a table, the form automatically refreshes and would be monitored by someone to ensure that the the user has logged their check call at a certain time.
On the form I have a unbound Text box which contains the current short time e.g (TextTime).
Currently the code is as follows -
If Me.TextTime.Value = Format("20:00 PM", "Medium Time") Then
DoCmd.RunSQL "INSERT INTO Checkcalltbl (CCOfficer,OfficerOK,CCSite,CCAutomatedSystem) VALUES ('" & TempVars!User & "'," & True & ",'Location'," & True & ")"
What I require is a window of 10 minutes before and after for the officer to log their check call otherwise there will be an else which will say that your check call cannot be taken at this time.
I have been playing around with the TimeSerial function but I can't get the coding right and could be barking up the wrong tree. I would have to enter additional Elseif for times at 10:00 PM, 12:00 PM, 2:00 AM, 4:00 AM so that other check calls can be made with the similar issue of 10 minutes before and after.
Am I going about this is the correct way, or should I be using the Dlookup function to be checking a table of listed times.
Your help and direction would be much appricated.
02-26-16, 09:18 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
understand the difference between the actual means of storage and presentation.
do comparisons on dates using the appropriate date time fucntiuons. dont' swing back and forth between textual representations of dates.
bear in mind that an Access control has data AND a representation of that data
so the actual data may be a number but the disaplyed value something else (this is true of date time values)
use datediff to determine a difference between one datetime value and anotherI'd rather be riding on the Tiger 800 or the Norton