2014-07-09 253 views
0

我想讓這個QC顯示文件失敗的原因。質量控制我有很好的作用,但當我試圖給出所有工作的原因,除了無效的郵政編碼。如果QC因任何其他原因而出現錯誤並出現錯誤,則說明該原因以及無效的郵政編碼。我已經將我的理由邏輯放在下面,並指出了我認爲有問題的地方。IIF不像在2007年的聲明

Reason: IIf([CNMC Import.Gf_Date] Is Null,"No gift date, ","") & IIf([CNMC Import.Gf_Amount] Is Null,"No gift amount, ","") & 
IIf([CNMC Import.Gf_CnBio_Key_Indicator] Is Null,"No individual or organization indicator, ","") & 
IIf([CNMC Import.Gf_CnAdrSal_Addressee] Is Null,"No Addressee, ","") & 
IIf([CNMC Import.Gf_CnAdrSal_Salutation] Is Null,"No Salutation, ","") & 
IIf([CNMC Import.Gf_CnAdrPrf_Addrline1] Is Null,"No street address, ","") & 
IIf([CNMC Import.Gf_CnAdrPrf_City] Is Null,"No city, ","") & 
IIf([CNMC Import.Gf_CnAdrPrf_State] Is Null,"No state, ","") & 
IIf([CNMC Import.Gf_CnAdrPrf_ZIP] Is Null,"No Zip Code, ","") & 
**IIf(([CNMC Import.Gf_CnAdrPrf_ZIP] Not Like "#####-####" & [CNMC Import.Gf_CnAdrPrf_ZIP]) Not Like "#####","Invalid zip code, ","")** 

回答

1

嘗試這(使用I如果2次):

IIf([CNMC Import.Gf_CnAdrPrf_ZIP] Like "#####-####", ",", IIf([CNMC Import.Gf_CnAdrPrf_ZIP]) Like "#####", ",", "Invalid zip code") 
+0

謝謝!正是我需要的 – Chuck

1

如果你想兩項檢查結合起來,那麼你就不能使用&跡象剛剛合併串在一起。

而不是

IIf(([CNMC Import.Gf_CnAdrPrf_ZIP] Not Like "#####-####" & [CNMC Import.Gf_CnAdrPrf_ZIP]) Not Like "#####","Invalid zip code, ","") 

嘗試

IIf([CNMC Import.Gf_CnAdrPrf_ZIP] Not Like "#####-####" AND [CNMC Import.Gf_CnAdrPrf_ZIP] Not Like "#####","Invalid zip code, ","") 
+0

返回相同的結果 – Chuck