Force Users to Enter Time in 15-Minute Increments in a Microsoft Access Time Card, Time Sheet

  Рет қаралды 3,344

Computer Learning Zone

Computer Learning Zone

Күн бұрын

Пікірлер: 7
@nmeofdst8
@nmeofdst8 3 жыл бұрын
instead of all the ANDs, you can put: Second([DTG])=0 And Minute([DTG]) In (0,15,30,45) For these situations, I like to use a combo box (or List box depending on data) with the Possible times pre-populated. I then set the properties of the Combo box to "Limit To List" Yes and "Allow Value List Edits" No. This makes it impossible for the User to enter invalid entries, which negates the need for validation checks (as an alternative).
@599CD
@599CD 3 жыл бұрын
Excellent suggestions! Thanks.
@resrussia
@resrussia 3 жыл бұрын
I tried a different approach to the issue using the following validation rule: Minute([DateTime]) Mod 15 =0. I tested this out and it seems to work and it seems like it would be more efficient way to code the validation. It appears that that checking for the seconds is not necessary unless the user's requirement specified seconds be entered as part of recording of the time and the number of seconds is significant for user's application. Three possible scenario based upon your student's question: Scenario 1: User is not required to enter seconds and the number of seconds is not significant for the application. If the user enters 1:15, then there is no reason to check the number of seconds, because Access will assume that 1:15 is 1:15:00, exactly a 15 minute interval. Scenario 2: User is required to enter seconds and the number of seconds is not significant for the application. If the user enters 1:15:34 then there is no reason to check the number of seconds, because the minute part of the time is important for application is only in the minute portion of the time. Scenario 3: User is required enter seconds and the number of seconds is significant for the application. If the user enters 1:15:34 then it will be necessary to check for seconds because application needs the have precisely 1:15:00. In this scenario, the validation function could look something like: Second([Date]) And Minute([DateTime]) Mod 15 =0 In the worst case scenario, a time with 45 in it, would take more time to evaluate because Access would need to check each of the other possibilities for minute (I assume that when one the minute comparisons is true, Access stops the evaluation process). Of course this analysis depends on the relevant amount it takes Access to execute Mod function vs comparing the results of each of Minute function. Your guidance on why your solution is better than my solution would greatly be appreciated.
@resrussia
@resrussia 3 жыл бұрын
One additional point to using the Mod function is that if business rule for the interval changes, the update is extremely simple. For example, suppose the business rule changes from 15 minute intervals to 10 minute intervals. Using the Minute([DateTimefield]) Mod 15 = 0 method, the change is merely changing the 15 to 10.The new statement would be Minute([DateTimefield] Mod 10 = 0 . Using the method in the video,all four the Or statements would need updating and two new Or statement would need to be added. So, Minute([DateTimefield]) = 00 Or Minute([DateTimefield]) = 15 Or Minute([DateTimefield]) = 30 or Minute([DateTimefield])=45 or Minute([DateTimefield]) =40 would become Minute([DateTimefield]) = 00 Or Minute([DateTimefield]) = 10 Or Minute([DateTimefield]) = 20 or Minute([DateTimefield])=30 or Minute([DateTimefield]) =40 or Minute([DateTimefield])=50 with last two statements needing to added.
@599CD
@599CD 3 жыл бұрын
Thank you for the suggestions. As with everything in Access there are always multiple ways to get the job done. :)
@hershqadirkalary731
@hershqadirkalary731 3 жыл бұрын
Thank you
@599CD
@599CD 3 жыл бұрын
You're welcome
Passing a Form as an Object Variable to a Global Subroutine in Microsoft Access VBA
18:24
Men Vs Women Survive The Wilderness For $500,000
31:48
MrBeast
Рет қаралды 101 МЛН
15 AWESOME OneNote Tips for Better Note Taking
29:46
Jonathan Edwards
Рет қаралды 4 М.
Stop Using FirstOrDefault in .NET! | Code Cop #021
12:54
Nick Chapsas
Рет қаралды 57 М.
Microsoft Access Customer Database (CRM) MS Access Customer Template - Free Download
26:40
Excel Formatting Tricks That Make You Look Like a Pro
12:15
MyOnlineTrainingHub
Рет қаралды 31 М.
Everyone is WRONG about Linux
13:04
Arnau's Disrepair
Рет қаралды 95
Microsoft Access DLOOKUP Without Programming
6:16
Computer Learning Zone
Рет қаралды 184 М.
Stop Doing Manual Reconciliations in Excel: Use Power Query
16:18
Excel University
Рет қаралды 78 М.
How to Easily Create an Data Entry Form in Excel | No VBA
22:30
Jopa Excel
Рет қаралды 28 М.