VBA和Microsoft Access

时间:2016-02-04 16:00:25

标签: ms-access access-vba

这是我第一次发帖提问。我是新手,并且正在使用Access 2016.我创建了几个用作字母的报告,我正在处理IIf语句,以便最大限度地减少我必须创建的报告数量。所以基本上我找不到错误或者正确的方法来写下面粘贴的下面的语句,我只发布了我遇到困难的部分。

="We, " & [Forms]![frmClaimDataEntry]![Client_First] & " " & [Forms]![frmClaimDataEntry]![Client_Last] & " & " & [Forms]![frmClaimDataEntry]![Client2_First] & " " & [Forms]![frmClaimDataEntry]![Client2_Last] & ", as owners of " & [Forms]![frmClaimDataEntry]![subfrmRisk]![RiskAddress] & ", " & [Forms]![frmClaimDataEntry]![subfrmRisk]![RiskCounty] &",  having already agreed to pay Murphy Loss Assessors” & IIf([Forms]![frmClaimDataEntry]![subfrmSettlement]![Fees_Discounted]>0,”a discounted fee upon settlement of our home insurance claim now confirm that we will discharge this payment of €"&[Forms]![frmClaimDataEntry]![subfrmSettlement]![Fees_Discounted], “10% plus VAT upon settlement of our home insurance claim now confirm that we will discharge this payment of €"& [Forms]![frmClaimDataEntry]![subfrmSettlement]![Fees_LA]) & " upon receipt of settlement cheque now expected in the amount of €" & Format([Forms]![frmClaimDataEntry]![subfrmSettlement]![DueNow],"Standard") & "."

2 个答案:

答案 0 :(得分:0)

*.lib中有一些印刷引号 - 如果这些也在您的代码中,则必须使用标准引号” “替换它们。

提示:使用文本编辑器编辑SQL(或Stack Overflow问题),而不是Word。

" "

始终在this payment of €"&[Forms]![frmClaimDataEntry]!之前和之后添加空格:

&

答案 1 :(得分:0)

也许你有一些Null值,Nz会在这里纠正:

="We, " & [Forms]![frmClaimDataEntry]![Client_First] & " " & [Forms]![frmClaimDataEntry]![Client_Last] & " & " & [Forms]![frmClaimDataEntry]![Client2_First] & " " & [Forms]![frmClaimDataEntry]![Client2_Last] & ", as owners of " & [Forms]![frmClaimDataEntry]![subfrmRisk]![RiskAddress] & ", " & [Forms]![frmClaimDataEntry]![subfrmRisk]![RiskCounty] & ", having already agreed to pay Murphy Loss Assessors " & IIf(Nz([Forms]![frmClaimDataEntry]![subfrmSettlement]![Fees_Discounted],0)>0,"a discounted fee upon settlement of our home insurance claim now confirm that we will discharge this payment of €" &[Forms]![frmClaimDataEntry]![subfrmSettlement]![Fees_Discounted], "10% plus VAT upon settlement of our home insurance claim now confirm that we will discharge this payment of €" & [Forms]![frmClaimDataEntry]![subfrmSettlement]![Fees_LA]) & " upon receipt of settlement cheque now expected in the amount of €" & Format([Forms]![frmClaimDataEntry]![subfrmSettlement]![DueNow],"Standard") & "."

此外,您可能拼错了控件名称。