How to create relationship of 2 tables using OleDbConnection
-
I have a MS Access Database that has 2 tables (for this example) Table_1 has a Filed named [ID] which is the Primary Key Table 2 has a field name [tbl1ID] I want to Create a relationship between Table_2 and Table_1 I tried:
"ALTER TABLE Table_2 ADD CONSTRAINT [tbl1ID] FOREIGN KEY (MyNewID) REFERENCES [Table_1](ID)"
I get the error "Can Not Find Table Or Constraint" I know Table_1 and Table_2 exists and I know ID is a filed in Table_1 and I know tbl1ID is in Table_2 So can anyone tell me where I went wrong?
-
I have a MS Access Database that has 2 tables (for this example) Table_1 has a Filed named [ID] which is the Primary Key Table 2 has a field name [tbl1ID] I want to Create a relationship between Table_2 and Table_1 I tried:
"ALTER TABLE Table_2 ADD CONSTRAINT [tbl1ID] FOREIGN KEY (MyNewID) REFERENCES [Table_1](ID)"
I get the error "Can Not Find Table Or Constraint" I know Table_1 and Table_2 exists and I know ID is a filed in Table_1 and I know tbl1ID is in Table_2 So can anyone tell me where I went wrong?
Not sure, but are
tbl1ID
andMyNewID
in the wrong order? -
Not sure, but are
tbl1ID
andMyNewID
in the wrong order? -
I have a MS Access Database that has 2 tables (for this example) Table_1 has a Filed named [ID] which is the Primary Key Table 2 has a field name [tbl1ID] I want to Create a relationship between Table_2 and Table_1 I tried:
"ALTER TABLE Table_2 ADD CONSTRAINT [tbl1ID] FOREIGN KEY (MyNewID) REFERENCES [Table_1](ID)"
I get the error "Can Not Find Table Or Constraint" I know Table_1 and Table_2 exists and I know ID is a filed in Table_1 and I know tbl1ID is in Table_2 So can anyone tell me where I went wrong?
-
Well It Looks like I had a typo after-all. I had a space in the sable name where it should have been an Underscore. Thanks.
I connect them by using a select query. Access is all about tables, querys and records