You can create a compound Index on those two fields. See attached image.
Note that you set the Unique property to Yes.
mx
Main Topics
Browse All Topicshi,
I have got a table which has an Items column which is the (auto number) primary key. I want to create a validation rule for the Issues table in such a way so that when the user enter a data for the Issues column, he will be only able to add distinct issues under the same ID column. In other words, Issues can repeat in different IDs but can't repeat under the same ID. How can I set up such a validation rule for Issues column in the table?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
"also while the user enters the data through a form, this message error message will show up right in case the values are duplicate?"
Yes. The error will be 3022. Again, if you like, you can trap this error in the Form Error event ... which allows you mainly to create a more 'user friendly' error message.
mx
Well, that's not exactly how you do it. You need to put some code 'behind' that Event.
Remove what you have now, then click back into the On Error line.
From the drop down list on the right, select [Event Procedure]
Then click on the ellipsis to the right of the drop down button (the 3 dots). Then you will see:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
End Sub
Insert this code between those two lines which will end up looking like:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Response = acDataErrContinue
If DataErr = 3022 Then
MsgBox "Cannot have duplicates of ID and Issues"
Else
MsgBox "Unexpected error occurred: " & Err.Number & " " & Err.Description
End If
End Sub
mx
Business Accounts
Answer for Membership
by: RaynePosted on 2009-08-09 at 15:26:01ID: 25056225
for example, its ok to have r3 under s1 and s2 But there cant be two r3 for s1 itself.