Forum Discussion
turniporangementions
Apr 02, 2022Copper Contributor
Update query to change data in a table
Table A has: HorseID (Number), HorseName (text)
Table B has: HorseID (Number), HorseName (text)
I want to update Table B HorseName to be the same as Table A Horsename, the HorseID would be the same, Table B has old names that have been change manually in table A
Thanks' for any help ....Bob
- George_HepworthSilver Contributor
Step one: Make back up copies of both tables, just in case.
Step two: make a back up copy of the accdb, just in case.
I wish I could use the real table names, but the Update query would be similar to this:
UPDATE TableB
INNER JOIN TableA ON TableB.HorseID = TableA.HorseID
SET [TableB].[HorseName] = [TableA].[Horsename];
I
- turniporangementionsCopper ContributorI've got this far
UPDATE tblHorseInfo INNER JOIN tblInvoice ON tblHorseInfo.HorseID = tblInvoice.HorseID SET
WHERE (((tblHorseInfo.HorseName)<>""));- George_HepworthSilver Contributor
"SET [TableB].[HorseName] = [TableA].[Horsename];"
See the difference?
"SET WHERE (((tblHorseInfo.HorseName)<>""));"
- arnel_gpSteel Contributorthis will Never happen:
tblHorseInfo.HorseName)<>""
when you left the field blank (or fill it with just spaces, access remove them), access will put Null to it.
you can either use:
Where Not (tblHorseInf.HorseName Is Null)
or
Where Len((tblHorseInf.HorseName & "") <> 0- turniporangementionsCopper ContributorThanks for the help, I am getting a syntax error on "="
UPDATE [tblInvoice].[HorseName] = [tblHorseInfo].[Horsename];
SET WHERE (((tblHorseInfo.HorseName)<>""));
Regards Bob