Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Two Tables

Status
Not open for further replies.

TorrediPisa

Programmer
Apr 15, 2004
67
IT
Hello everyone.
I have created two Tables (CUSTOMERS and ORDERS) using DAO.
CUSTOMERS ORDERS
ID ID
NAME ID_CUSTOMER
ADDRESS

On CUSTOMERS I have created ID As Primary Key by the following:
db.Execute "CREATE UNIQUE INDEX IDX ON CUSTOMERS ID WITH PRIMARY "

Now I want to link ID of CUSTOMERS with ID_CUSTOMER of ORDERS Table (Cardinality 1 to Many) with the Referential Integrity and with the Cascade Delete Related Records set.
How can I do this by the db.execute?
Thank You for yr kind help.
Best Regards
 
you do realize that with the Cascade Delete enforced that if you delete a customer you will delete all the orders associated with that customer. Not normally a good practice.

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Thank You for yr reply.
Regardless the real good practice, can you suggest me the code to do that?
Regards
Fabio
 
No i don't know how to do that programatically, but why would you want to delete orders? How are you EVER going to have accurate sales reports if you delete orders?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top