Access 2010: How can I create an error message when data isn't entered correctly?

The database I'm building has two tables: [Positions] and [Staff]. The positiong number (posn #) is how the tables are linked; it is the primary key in [Positions] and is a requred field in [Staff].

I'd like to make it so that if the posn # entered in [Staff] doesn't match one of the posn # in [Positions], an error message would come up to say that it was entered incorrectly. This is to ensure that data entry is done correctly, otherwise the accuracy of the various reports I've created will be flawed.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
a better way is to set the relationships between this two table..
see how from
How to define relationships between tables in an Access database

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You can avoid validation code by using a combo box.  Set the LimitToList property to Yes and AllowValueListEdits to no.  Also make the field required in the table definition and make sure the default is null.  Some versions of Access use a default of 0 for numeric fields so you may have to remove the 0.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.