-----Original Message-----
Hi,
Since you use illegal names, you have to enclose them in [ ].
UPDATE [Part List Translated] INNER JOIN Codes ON [Part List
Translated].Code=Codes.[Old Code] SET [Part List
Translated].Code=Codes.Code
where I assume Codes.Code hold the new codes.
The referential data integrity can be edited in the Relations window. Right
click a relation between tables, and a kind of properties sheet would appear
(or bring the two tables, drag and drop related field of one table over the
other) and you have to Enforce the relation and to check the Cascade Update.
From that point, any modification of a value in the table of reference will
be propagate to (each of) the referred table. You have to edit such a
relation for each field that have that relation, for each table referring to
the related table. Note that enforcing a relation implies that a value in
the "foreign" table field MUST be in the "referred" table too, or the update
(or the append of a new record) in the foreign table will be rejected. This
way, you are sure that any value in the foreign table field has a match in
the referred table field.
Hoping it may help,
Vanderghast, Access MVP
Hi Michel ;
I am sorry , not sure I follow you . ( I am a beginner).
I have created the conversion table named "Codes" , fields
are “Code” “Description” and “Old Code”
..
My other table named "Part List Translated " ,that I would
like to convert the Code field with the new codes has
following fields ; “Part Number” “Part Description”
and “Code1” .
Could once again explain what I should write in my query
to get the result .
Could you also let me know what is "cascade update
referential data integrity"?
Thanks
Steve
-----Original Message-----
Hi,
Then, use cascade update referential data integrity, that will care
about the tables referencing the code. For the code, make a conversion
table:
Conversions ' table
FromThis, ToThis ' fields
'x'', 'xyz'
'y', 'y22' 'data
then,
UDPATE myCodes INNER JOIN Conversions ON myCodes.code =
conversions.FromThis
Set myCodes.code = conversions.ToThis
would update the table of code, and, by cascade, the dependant tables too.
Just one simple query, as many code you want... really, can't be simpler,
no?
Hoping it may help,
Vanderghast, Access MVP
Hi Michel ;
Thank you very much for your reply .
However –unfortunately – I think the problem is much more
complex than I have given in the example.
One of the reason for that is the reference table of old
vs new codes may change frequently . (I have linked that
table to a database)
For example ;
Code Z might have changed to “AD2” but may change to
“AD3”
next month (or change to something else the month after ) .
And the other reason is I have hundreds of these codes
which should be changed with the new ones so that I think
it will take too much time to write one by one which code
should be what .
What I would like to do is ,as in excel with Vlookup
function , to update the code fields automatically
referring to a reference table where the old code and the
new code is stated .
I believe I could do that in excel with vlookup , but my
tables may change (I could have new products or less
products which are not in use) so I have linked the tables
in access .
Thank you very much
Code1='C', 'CXT', TRUE, Code1),
.
.