Thanks John.
It would have been neat to do this with an UPDATE (only on line of code) but well you can't get everything.
Must have read this in the ANSI SQL book. I know I've seen this UPDATE somewhere. Well never gonna know I spose.
>You cannot use JOIN in an UPDATE in either VFP or SQL Server (Can't figure out which you are trying). UPDATEs are for a single table only. If in VFP, you can do the following (works best if you have an index on "field"):
>
>USE tab1 IN 0 ORDER field
>USE tab2 IN 0 ORDER field
>SELE tab1
>SET RELA TO field INTO tab2
>REPLACE tab1.field WITH tab2.field
>
>
>>I'm trying to write an SQL UPDATE but I'm not having any luck.
>>It looks like this:
>>
>>UPDATE TAB1 JOIN TAB2 ON TAB2.FIELD = TAB1.FIELD SET TAB1.PK = TAB2.PK
>>
>>I want to update TAB1.PK with TAB2.PK where TAB1.FIELD = TAB2.FIELD and there's an one to one relation between the two FIELD:s.
>>I don't know what I'm doin wrong but all TAB1.PK equals record no one PK in TAB2.
>>Any ideas???
Magnus NordinVFP MCP
"We have tested the GUI on 5-year olds. Why? Beacuse they aren't braindead!"
Michael Spindler, Apple