Unique prevent records duplication

Stabu

New member
Local time
Yesterday, 21:05
Joined
Oct 8, 2008
Messages
1
I've seen plenty of examples of preventing duplicate records from being entered from a form but this is somewhat unique. I have about 26 trips that go out daily, it's usually the same trucks, drivers and routes. the only variable is the date time out and in. What I want to prevent is the data being entered twice on a given day. If I try to use soemthing like the field [route] and [datetimeout] thats no good because the default for [datetimeout] is Now() and just checking the box would create a unique record and be entered. My thought is to use a dlookup function on before update. To make this work I need it to read the forms combox or the hidden route field on the form and match up all the matching routes. Then it needs to lookup the time in field in the table to see if one is null. If it is put up a msgbox that says you've already entered it and then exit the form. The logic is if you've entered a route for that day it has'nt returned yet (trips are at least 7 hours round trip). The data entry is done within an hour of depature. But folks do forget if they have entered them already when things get busy.
 
if you use date() rather than now() you will just get the date,rather than date and time

if you need the time, then have another field just for the date - then you will be able to use your unique date indicator
 
Hi,
Have the [DateTimeOut] , and [DateTimeIn] fields prodperty's in the table structure set to Now().
On the form where you actually enter the Time Out and Time In, have the properties of the text boxes set to "MediumTime" with an input mask allowing only times such as "10:05" etc entered.
If you enter the same time for the same route as an earlier entry on the same day, you could run your query to notify you of this and show a message box.
 

Users who are viewing this thread

Back
Top Bottom