Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Error Using Update Statement

Status
Not open for further replies.

mark1110

Programmer
Apr 20, 2005
85
US
I am getting a syntax error when I try to use an update statement. Here is the statement:

UPDATE sales_rep_by_mbu
SET sales_rep_by_mbu.SRRSM = producer_sales_role_codes.sales_role_cd_value
FROM producer_sales_role_codes, sales_rep_by_mbu
WHERE (sales_rep_by_mbu.tin = producer_sales_role_codes.tin AND sales_rep_by_mbu.company_cd = producer_sales_role_codes.company_cd AND
sales_rep_by_mbu.state = producer_sales_role_codes.state AND producer_sales_role_codes.sales_role_cd = "RSM" AND producer_sales_role_codes.mbu_cd = "SR")


When I run this statement, it works fine:

SELECT producer_sales_role_codes.sales_role_cd_value
FROM producer_sales_role_codes, sales_rep_by_mbu
WHERE (sales_rep_by_mbu.tin = producer_sales_role_codes.tin AND sales_rep_by_mbu.company_cd = producer_sales_role_codes.company_cd AND
sales_rep_by_mbu.state = producer_sales_role_codes.state AND producer_sales_role_codes.sales_role_cd = "RSM" AND producer_sales_role_codes.mbu_cd = "SR")

Could someone please help me.


Mark
 
Where are you running this statement from? If from SQL Server, you're very definitely in the wrong forum.

If from an Access Control, please give more background - name of form, control, what VBA code or macro is calling it, etc...

--

"If to err is human, then I must be some kind of human!" -Me
 
Try

Code:
UPDATE sales_rep_by_mbu
inner join producer_sales_role_codes
on sales_rep_by_mbu.tin = producer_sales_role_codes.tin 
AND sales_rep_by_mbu.company_cd = producer_sales_role_codes.company_cd 
AND sales_rep_by_mbu.state = producer_sales_role_codes.state 
SET sales_rep_by_mbu.SRRSM = producer_sales_role_codes.sales_role_cd_value 
WHERE
AND producer_sales_role_codes.sales_role_cd = "RSM"  
AND producer_sales_role_codes.mbu_cd = "SR"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top