访问公式太多字符

时间:2018-05-15 14:06:32

标签: ms-access formula

所以看起来访问的字符数限制为255 ...我的公式有更多的字符。

我正在寻找替代方案,以便在访问中使用它。

公式:

IFF(([FINAL]![CODE]="2022" OR [FINAL]![CODE]="2015" OR [FINAL]![CODE]="2016" OR [FINAL]![CODE]="2011" OR [FINAL]![CODE]="2012" OR [FINAL]![CODE]="2030" OR [FINAL]![CODE]="2032" OR [FINAL]![CODE]="2007" OR [FINAL]![CODE]="2009" OR [FINAL]![CODE]="3040" OR [FINAL]![CODE]="3041" OR [FINAL]![CODE]="2001" OR [FINAL]![CODE]="2002" OR [FINAL]![CODE]="2019" OR [FINAL]![CODE]="2020" OR [FINAL]![CODE]="2024" OR [FINAL]![CODE]="3028" OR [FINAL]![CODE]="2028"),"Renewal",



IFF(([FINAL]![CODE]="3051" OR [FINAL]![CODE]="3052" OR [FINAL]![CODE]="3010" OR [FINAL]![CODE]="3006"),"Shrink",



IFF(([FINAL]![CODE]="2021" OR [FINAL]![CODE]="2025" OR [FINAL]![CODE]="2026" OR [FINAL]![CODE]="2029" OR [FINAL]![CODE]="2031" OR [FINAL]![CODE]="2014" OR [FINAL]![CODE]="2003" OR [FINAL]![CODE]="2005" OR [FINAL]![CODE]="3038" OR [FINAL]![CODE]="3039" OR [FINAL]![CODE]="2013" OR [FINAL]![CODE]="2017" OR [FINAL]![CODE]="2004" OR [FINAL]![CODE]="2018" OR [FINAL]![CODE]="2006" OR [FINAL]![CODE]="2008" OR [FINAL]![CODE]="2010" OR [FINAL]![CODE]="2023" OR [FINAL]![CODE]="3027" OR [FINAL]![CODE]="2027"),"St OR age",



IFF(([FINAL]![CODE]="3043" OR [FINAL]![CODE]="3048" OR [FINAL]![CODE]="3008" OR [FINAL]![CODE]="3012" OR [FINAL]![CODE]="3056" OR [FINAL]![CODE]="3046" OR [FINAL]![CODE]="1010"), "PickFee",



IFF(([FINAL]![CODE]="3057" OR [FINAL]![CODE]="3036" OR [FINAL]![CODE]="3015" OR [FINAL]![CODE]="3037" OR [FINAL]![CODE]="3003" OR [FINAL]![CODE]="3004" OR [FINAL]![CODE]="3058"), "LabelFee",



IFF([FINAL]![CODE]="1003", "In/Out",



IFF([FINAL]![CODE]="3037", "CaseLable",



IFF(([FINAL]![CODE]="1021" OR [FINAL]![CODE]="1022" OR [FINAL]![CODE]="1004"),"Devan",



IFF(([FINAL]![CODE]="1016" OR [FINAL]![CODE]="1017" OR [FINAL]![CODE]="1020" OR [FINAL]![CODE]="1005" OR [FINAL]![CODE]="1019" OR [FINAL]![CODE]="1005"),"DocFee",



IFF(([FINAL]![CODE]="3049" OR [FINAL]![CODE]="3001" OR [FINAL]![CODE]="3011"),"Pallet", "Other"))

)

)

)

)

)

)

)

)

1 个答案:

答案 0 :(得分:1)

两个选项,首先是清洁:

1)创建一个转换表CodeToLabel:

Code | Label
-----+--------
2022 | Renewal
2015 | Renewal
...  | ...

然后把它拉出来:

SELECT Label FROM CodeToLabel WHERE Code = [FINAL]![CODE]

如果您填写表单字段,也可以使用DLookup

2)将代码放入VBA模块并调用它:

= CodeToLabel([FINAL]![CODE])

Public Function CodeToLabel(code As String) As String
    ... code here
    CodeToLabel = label
End Function