var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Relationships between table
Is it possible to create a relationship between two tables on two fields using a code? If yes, small example would be great.
what does "using a code" mean?
By "Using code" I ment using Visual Basic - commands etc.
There is always DoCmd.RunSQL followed by whatever SQL command you wish to use to accomplish the intended task .
oh, i get it, you mean, can you declare a relationship between two tables using data definition language or DDL, which is a subset of SQL
yes, you can
see ACC2000: Create and Drop Tables and Relationships Using SQL DDL
would it be possible to write a small example how to do that. Just for two tables related on two fields.
Thank you DJ
did you read that page?
here's the example they used --
so to make the relationship on two columns, you would put the two columns where the [Id] column is in their example
After you create both tables, running the following query creates a one- to-many relationship between Table1 and Table2, with Table1 as the primary side of the relationship:
ALTER TABLE Table2
ADD CONSTRAINT Relation1
FOREIGN KEY ([Id]) REFERENCES Table1 ([Id])