Block duplicate entries using multiple fields as criteria

N

Nathan Wolfe

The form needs to not allow entries that have the same Location, Date, and
Time and pop an error message up to inform the user that they need to change
something. On other threads in the forum I've seen similar problems that look
like they've been solved using an IF statement with DLookup. Can someone help
me with the syntax?

In my database users are going to enter event data through a form called
"frmStopDailyCount" based on a table called "tblStops". The fields stored in
the table are: Location, Datestop, Timestop, LengthStop, Stoptype, Visitors
and Questions. The names of the entry fields on the form are based off these
with: cboLocation (which actually is drawn off a second table,
"tblLocationNames"), cboDate, txtTimestop, txtLengthstop, cboStoptype,
txtVisitors and txtQuestions.

Generally, a user is going to enter several events starting with the same
location and entering different dates, or the same date with different times.
I've made the form so that when info is entered the first time, the same
Location, Date, and Time, Length and StopType populate the fields when the
user goes to a new record. This speeds up data entry considerably because the
user doesn't have to enter the same information twenty times over when they
only need to change the date and add stats to Visitors and Questions.
However, it does cause the problem that duplicate values may be put in for
the Date & Time. There cannot be two events at the same place, date and time,
but there may be two events at the same place at different times, or
different locations at the same date and time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top