当我单击MS Access中的“发送电子邮件”按钮时,将运行以下命令:
EmailDatabaseObject
To: =DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Assigned To],0))
CC: =IIf(DLookUp("[E-mail Address]","Contacts","[ID]=" &
Nz([Opened By],0))=DLookUp("[E-mail Address]","Contacts","[ID]=" &
Nz([Assigned To],0)),"",DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Opened By],0)))
以及其他主题,消息等项目。
我想在“抄送”字段中添加另一个电子邮件地址。
答案 0 :(得分:3)
由于宏中的AndroidX
字段当前包含一个CC
语句,因此需要进行的修改取决于您是否希望在所有情况下将电子邮件发送到其他电子邮件地址,或者仅用于验证 iif
测试表达式的情况。
当前,您的iif
语句正在执行以下测试:
iif
也就是说:
如果=IIf
(
DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Opened By],0))=
DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Assigned To],0)),
"",
DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Opened By],0))
)
ID的联系人电子邮件地址等于Opened By
ID的联系人电子邮件地址,则Assigned To
字段为空(因为{{ 1}}字段已经包含CC
电子邮件地址);否则,请使用To
电子邮件地址。
最简单的修改当然是将附加的电子邮件地址简单地连接到Assigned To
语句的开头或结尾,例如:
Opened By
iif
但是,对于=IIf
(
DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Opened By],0))=
DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Assigned To],0)),
"",
DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Opened By],0))
)
& ";email@email.com"
电子邮件地址等于="email@email.com;" &
IIf
(
DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Opened By],0))=
DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Assigned To],0)),
"",
DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Opened By],0))
)
电子邮件地址的情况,这将产生前导/后缀分号。
因此,为确保您不会留下前导/尾随的分号,您不妨使用:
Opened By
答案 1 :(得分:1)
抄送应为
CC: =IIf(DLookup("[E-mail Address]", "Contacts", "[ID]=" & Nz([Opened By], 0)) = DLookup("[E-mail Address]", "Contacts", "[ID]=" & Nz([Assigned To], 0)), "", DLookup("[E-mail Address]", "Contacts", "[ID]=" & Nz([Opened By], 0)) & ";" & "email@email.com")
答案 2 :(得分:0)
只需将现有的IIF(.....)与所需的电子邮件地址连接即可。 伪代码:
a = IIF(......)
b = "email@email.com"
c = a + ";" + b
.
.
.
CC = c