将一个长sql vba语句分成多行

前端之家收集整理的这篇文章主要介绍了将一个长sql vba语句分成多行前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我对VBA气氛完全不熟悉.我试图把这条线分成多行,但我失败了.有人可以帮我把这段代码分成多行吗?
DoCmd.Runsql "UPDATE INDIVIDUAL SET INDIVIDUAL.INDI_FIRSTNAME = '" & prospect_contact!FirstName & "',INDIVIDUAL.INDI_LASTNAME = '" & prospect_contact!LastName & "',INDIVIDUAL.INDI_TEL = '" & prospect_contact!BusinessTelephone & "',INDIVIDUAL.INDI_ADDRESS1 = '" & Replace(prospect_contact!Street,"'","") & "',INDIVIDUAL.INDI_ADDRESS2 = '" & Replace(prospect_contact!Street1,INDI_STATUS = '" & pro & "',INDIVIDUAL.INDI_FUNEL1 = '" & prospect_contact!QualificationStatus & "',INDIVIDUAL.INDI_COUNTRY = '" & prospect_contact!Country_Employer & "',INDIVIDUAL.ACCT_NAME = '" & Replace(prospect_contact!Employer,"") & "' WHERE INDIVIDUAL.INDI_FULLNAME = '" & key & "';"

更新:我尝试使用& _但是我收到语法错误,代码在VBA中变为红色.
我用逗号或引号搞错了.我不知道.

DoCmd.Runsql "UPDATE INDIVIDUAL SET INDIVIDUAL.INDI_FIRSTNAME = '" & prospect_contact!FirstName & "',& _
                    INDIVIDUAL.INDI_LASTNAME = '" & prospect_contact!LastName & "',& _
                    INDIVIDUAL.INDI_TEL = '" & prospect_contact!BusinessTelephone & "',& _
                    INDIVIDUAL.INDI_ADDRESS1 = '" & Replace(prospect_contact!Street,& _
                    INDIVIDUAL.INDI_FUNEL1 = '" & prospect_contact!QualificationStatus & "',& _
                    INDI_STATUS = '" & pro & "',& _
                    INDIVIDUAL.INDI_COUNTRY = '" & prospect_contact!Country_Employer & "',& _
                    INDIVIDUAL.ACCT_NAME = '" & Replace(prospect_contact!Employer,"") & "' & _
                    WHERE INDIVIDUAL.INDI_FULLNAME = '" & key & "';"

更新2:

有用!有用!有用!感谢@Bathsheba,@ TheLaurens 原文链接:https://www.f2er.com/mssql/77462.html

猜你在找的MsSQL相关文章