我对 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 :)