Prevent Duplicate Date in Table

burrina

Registered User.
Local time
Today, 10:22
Joined
May 10, 2014
Messages
972
I don't want to allow more than one instance of (HolDte) for the same EmployeeID

PHP:
 If DLookup("[HolDte]", "tblHour", "[EmployeeID]='" & Me.EmployeeID.Value & "'") <> Me.HolDte.Value Then
    Exit Sub
End If
 
Last edited:
create a combined index on holdate and employeeid in your table
 
Thanks for the suggestion. It does not seem to be working for me with my current design.
1. If some criteria then open form, do not open form.
2. Form opens and code runs to append data into table.

A. I would ideally opt to not have the form open via code if criteria is not met.
 
You need a unique composite index HolDte and EmployeeID.

See this link

The unique composite index will be enforced by Access software.
Good luck.
 
Thanks for the suggestion. It does not seem to be working for me with my current design.
1. If some criteria then open form, do not open form.
2. Form opens and code runs to append data into table.

A. I would ideally opt to not have the form open via code if criteria is not met.

You need to spell exactly what you want to happen in the test. What is the problem ? The code you show doesn't work for you ? Where does it fail ? Can the tblHour table have nulls in the holdate ? You need to provide more info.

Best,
Jiri
 

Users who are viewing this thread

Back
Top Bottom