How do you prevent duplicate entries in a non-PK field?

oZone

Registered User.
Local time
Today, 06:34
Joined
Oct 17, 2008
Messages
103
I have a home movies database that I'm creating and am trying to prevent the user from entering duplicate star names. My initial thought was to simply make the star name field a PK, but I cant because if I do it breaks some of the relationships.

So, I'm curious if there's a semi-easy way to prevent the user from entering duplicate entries in a field that is not a PK?

My form, AddStars, allows the user to enter a new star name into the Stars table, but it does not prevent duplicate star names from being entered.

I'm thinking maybe with a query, but I dont know how to do this...:rolleyes:

Heres the layout of my DB if it helps:
tblMovies (MovieID, MovieTitle, Media, Rating, Genre, Watched, Liked, Description, Notes)
tblStarsToMovies (StarID [FK], MovieID [FK])
tblStars (Name, StarID)

If I set the Name field in tblStars as a PK, I dont have.... well you see my dilema...:o

Help?:confused:
Ultimately I just need to prevent against duplicate actor names being entered.
 
Last edited:
You can set the field in the table to be INDEXED (No DUPLICATES).
 
Exellent! Thanks for the tip! It worked brilliantly of course.:D

Your advice sir is like that of pure gold; highly valuable and... umm.... goldish in color??? I dunno... lol
What I'm trying to say is, THANKS!!!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom