Kdankwah
asked on
Update error
What am I doing wrong? I am getting a missing syntax error on this update that I am running in MS Access.
UPDATE TB_Jul_Aug INNER JOIN Distribution list ON TB_Jul_Aug.NickName = Distribution list.NickName SET TB_Jul_Aug.Dept = Distribution list.DEPT, TB_Jul_Aug.segment = Distribution list.segment;
Thanks
UPDATE TB_Jul_Aug INNER JOIN Distribution list ON TB_Jul_Aug.NickName = Distribution list.NickName SET TB_Jul_Aug.Dept = Distribution list.DEPT, TB_Jul_Aug.segment = Distribution list.segment;
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And this is an alternate syntax:
UPDATE TB_Jul_Aug, [Distribution list]
SET TB_Jul_Aug.Dept = [Distribution list].DEPT, TB_Jul_Aug.segment = [Distribution list].segment
WHERE TB_Jul_Aug.NickName = [Distribution list].NickName
ASKER
It worked but I am getting its updating 0 rows. Am I doing anything wrong?
That means that you have no records meeting the criteria:
TB_Jul_Aug.NickName = [Distribution list].NickName
Check for differences in leading/trailing spaces, etc ....
TB_Jul_Aug.NickName = [Distribution list].NickName
Check for differences in leading/trailing spaces, etc ....
ASKER
The nick names are in [Distribution list].NickName and I am updating the NickName column in TB_Jul_Aug.NickName . Is my syntax right?
Thanks
Thanks
Not quite...
If you need to update the NickName column, your syntax should be:
What field 'links' the two tables?
Use that field name to replace "LinkingFieldName" in my query....
If you need to update the NickName column, your syntax should be:
UPDATE TB_Jul_Aug, [Distribution list]
SET TB_Jul_Aug.NickName = [Distribution list].NickName
WHERE TB_Jul_Aug.LinkingFieldName = [Distribution list].LinkingFieldName
What field 'links' the two tables?
Use that field name to replace "LinkingFieldName" in my query....
In explanation, the SET clause specifies the column that gets updated.
ASKER
I think I know why its doing that, some of the nick names although different are pointing to the same dept and segment. How do you rectify that. Its as if the system will have to update two nicknames on the same record. Bad data I guess. Two people will get the same report based on the same dept and segment.
Thanks
Thanks
What exactly needs to be updated and what field(s) define the relationship between the two tables?
If you are trying to update the NickName, you should be using a syntax similar to my last comment (NickName needs to be in the SET clause).
If you are trying to update the NickName, you should be using a syntax similar to my last comment (NickName needs to be in the SET clause).
Maybe this?
UPDATE TB_Jul_Aug, [Distribution list]
SET TB_Jul_Aug.NickName = [Distribution list].NickName
WHERE TB_Jul_Aug.Dept = Distribution list.DEPT AND TB_Jul_Aug.segment = Distribution list.segment;
ASKER
I did set the SET clause to NickName because NickName defines the relationship and that needs to be updated in the TB_Jul_Aug. I am going to eliminate the duplicate dept and segment on the distribution list and see what happens. I will keep you posted.
Thanks
Thanks
ASKER
It does not work, now back to the drawing board. All I want is to update the master data in order to run a query and run a report. Since that is not working,do you guys have any other way and means under your sleeve to do this without updates?
For example if I want Sams departments I want to create a qurey with Sams nickname and run all of Sam's report. Hope I am clear on this. Please help.
Thanks
For example if I want Sams departments I want to create a qurey with Sams nickname and run all of Sam's report. Hope I am clear on this. Please help.
Thanks
What exactly doesnt work? My first post addressed the syntax issues in your original question, and what you are asking now is different and unclear to me. You should close this question and post a new one which clearly defines what you are trying to do. Posting sample data and expected results may help.
ASKER
"Missing operator in query expression......"