The Scenario:
My database contains 6 tables; the one that needs updating is [tblProgramsGiven]. In this table is a memo field called [Notes] and in many records I put a note in about the lead person who gave the program. I decided to make a new table - [tblRangers] - that includes all the people who give programs. It has an auto-number PK - [RangerID_PK] - and two text fields: [RangerFirstName] and [RangerLastName] After adding this new table, I added a number field to [tblProgramsGiven] which is [RangerID_FK] and joined the two tables (1-many).
The Goal:
I want to update [tblProgramsGiven].[RangerID_FK]; if the name found in [tblProgramsGiven].[Notes] matches [tblRangers].[RangerLastName] then it should update [tblProgramsGiven].[RangerID_FK] to match [tblRangers].[RangerID_PK]
The SQL:
Below is my amateur attempt to write the SQL for this update query.
What am I missing to accomplish my goal?
My database contains 6 tables; the one that needs updating is [tblProgramsGiven]. In this table is a memo field called [Notes] and in many records I put a note in about the lead person who gave the program. I decided to make a new table - [tblRangers] - that includes all the people who give programs. It has an auto-number PK - [RangerID_PK] - and two text fields: [RangerFirstName] and [RangerLastName] After adding this new table, I added a number field to [tblProgramsGiven] which is [RangerID_FK] and joined the two tables (1-many).
The Goal:
I want to update [tblProgramsGiven].[RangerID_FK]; if the name found in [tblProgramsGiven].[Notes] matches [tblRangers].[RangerLastName] then it should update [tblProgramsGiven].[RangerID_FK] to match [tblRangers].[RangerID_PK]
The SQL:
Below is my amateur attempt to write the SQL for this update query.
Code:
UPDATE tblProgramsGiven INNER JOIN tblRangers ON tblProgramsGiven.RangerID_FK = tblRangers.RangerID_PK
SET tblProgramsGiven.RangerID_FK = tblRangers.RangerID_PK
WHERE tblRangers.RangerLastName = "*" & [tblProgramsGiven].[Notes] & "*";
What am I missing to accomplish my goal?