Deleting/Creating a relationship between two tables -----> Help Pl

F

FatMan

Hi all:
I would like to know how to break and create a relationship between two
tables.

I have created a database to handle the capturing of out inventory stock
count/take. Part of the setup routine is creating tables in the database
from the tables in our accounting system. I must recreate them each time the
database is used to capture the current inventory levels as well as any new
items created since our last inventory count from our accounting system. In
order for me to do this I must manual remove the relationships between the
two tables, run the set up program to create the tables, and then create the
relationship between the two tables. This is not a big deal for me to do but
someone that has less experience with Access the deleting and creating of the
relationships can be quite daunting.

The table names are tblInvMaster with a primary key of StockCode and
tblInvCapture with a foreign key of StockCode. The relationship is a one to
many relationship with the one being the tblInvMaster and the many being
tblInvCapture. I do enforce Referential Integrity but do not do any cascade
deletes/updates.

Can someone please show me the code to delete and create a relationship
between two tables based on the above info. Any and all help is greatly
appreciated.

Thanks,
FatMan
 
M

Marshall Barton

FatMan said:
I would like to know how to break and create a relationship between two
tables.

I have created a database to handle the capturing of out inventory stock
count/take. Part of the setup routine is creating tables in the database
from the tables in our accounting system. I must recreate them each time the
database is used to capture the current inventory levels as well as any new
items created since our last inventory count from our accounting system. In
order for me to do this I must manual remove the relationships between the
two tables, run the set up program to create the tables, and then create the
relationship between the two tables. This is not a big deal for me to do but
someone that has less experience with Access the deleting and creating of the
relationships can be quite daunting.

The table names are tblInvMaster with a primary key of StockCode and
tblInvCapture with a foreign key of StockCode. The relationship is a one to
many relationship with the one being the tblInvMaster and the many being
tblInvCapture. I do enforce Referential Integrity but do not do any cascade
deletes/updates.

Can someone please show me the code to delete and create a relationship
between two tables based on the above info.

Before going into all that relationship stuff, would you
please explain why you can not just delete all the existing
records and then append the new info.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top