By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,204 Members | 1,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,204 IT Pros & Developers. It's quick & easy.

I need to put a restriction/validation in a table that is linked to another table

P: 1
OK here's the deal...

I have a table called Orders, and I have a field called "Customer ID" which is a primary key in the table "Customers". I want to put a restriction so that when someone puts a number in the order table in the "Customer ID" field that doesn't exist(in the Customers table), an error message pops up and says to put a valid number into it. Right now, I have about 12 customers. So theoretically, if I put 24 under the Customer ID field in the Order Field, I want it to give me an error message because it doesn't exist in the Customers table. How do I do it? Please help me

Perhaps something else that may help: The "Customer ID" is an automated field; the max right now is 12, but if i add another customer, the max will be 13. I have looked into such things such as Dlookup, expressions, and what not, and have not been successful in doing what I intend to do. I am assuming my answer lies within the validation area of the design view of the orders table. I just don't know what it is. I need the input of that field(Customer ID) in that table (Order table) to be equal or less than the max number of the Customer ID in the Customer ID table. I worked on it for quite a while and cannot get the answer. I am dealing with 2 tables in this instance, not 2 reports, 2 queries, or anything of that sort. Putting a preset number would be easy (i.e. "<100") but I want something more sophisticated that would stop the user right there and then to tell them the customer Id they inputted does not exist.
Dec 2 '13 #1
Share this Question
Share on Google+
1 Reply


zmbd
Expert Mod 5K+
P: 5,397
This is simply accomplished thru the table relationships.

Please Work thru this example tutorial. It will explain 90% of what you want and need to do: MS Access 2010 Tutorials

THen look thru thus: Access Basics - By Crystal

Finally you absolutly need to understand: > Database Normalization and Table Structures.
Dec 2 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.