aussie Posted September 5, 2001 Posted September 5, 2001 i have created files for suppliers, products and supplier_products. in the supplier_products file i want to restrict the data to only 1 instance of supplier and product. ie i want to create a combined primary key of the foreign keys supplier_code and product_code. eg supplier_a,prod_a supplier_a,prod_b supplier_b,prod_a if the user enters supplier_a,prod_a again i want an error to occurr due to file validation. if that makes any sense to you i would appreciate your help.
Kurt Knippel Posted September 5, 2001 Posted September 5, 2001 2 very easy way to accomplish this, and 1 caution. First the caution, do NOT make this the primary key. ALWAYS make your Primary (thus Foreign) keys out of non-user enterable/editable data. I simply use an ID scheme that I detailed in a FAQ at http://www.fmforums.com/ubb/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=8&t=000018 As far as the user is concearned this field can be the primary identifier, but do not make the mistake of believing this yourself. Ok, now you can validate this many ways, the two easiest are: field validation, requiring that the field be a unique value and giving the user a message that indicates what has happened and how to fix it; the other way is to do your data entry into global fields, then validate that entry with scripting. The second option is more work, but you get alot more control over how to deal with the error.
Recommended Posts
This topic is 8551 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now