View Single Post
  #4  
Old August 27th, 2009, 01:55 AM posted to microsoft.public.access.gettingstarted
Lostguy
external usenet poster
 
Posts: 73
Default Prevent duplication of entries from different tables?

All,

Here's the final setup (I am leaving out some of the supporting lookup
tables):

40 employees (30 civilian, 10 military) divided among 4 sections.
Setup:
tblEmployee: EmployeeIDpk(1), LName
(Data for each employee)

tblEventType: EventTypeIDpk (1), EventName, EventPeriodicity,
ApplicableTo, CivMilBoth
(Data for each eventtype: Flu Shot, 365 (days), all (sections), Both
(Civilian, Military, or Both))

tblEVentWhen: EventWhenIDpk (join), EventTypeIDfk (many), EventDate,
EventRemarks
(When each event took place)

tblEmpEvent: EventWhenIDfk (join), EmployeeIDfk (many), EmpEventIDpk
(Which employees did which events)

All relationships are ref int with Join Type 1 (With the 1's and
many's shown above), except for the two "joins" shown above that I had
to uncheck ref integrity because I kept getting the error that I could
not delete a record because it had a related record....??

The frmEVentEntry (based on tblEventWhen) with fields EventDate,
EventTypeIDfk (combo), and EventRemarks
The continuous subform is from tblEmpEVent with EmployeeIDfk (combo)

Problem: I only need the last time an event was done, not the past
occurrences. So, for this, I need to prevent the combination EventType
(what) and EmployeeID (who) and EventWhen (when) from duplicating.
Since two of these are in one table and one is in another, I can't do
a multifield index. But I can do a query. Can you do indexes on a
query? To do the DLookup thing, I would need to change the
RecordSource of the forms to be off the query rather than the table?
(Sorry. I just don't know enough to know how to set this up. The user
should not be able to enter duplicate data in this combination, and if
they try, they should get a message that says "This combination of
event elements was entered on XX/XX/XXXX. Please update the older date
to the new.)

??

VR/Lost