Access 2007验证规则

时间:2016-01-27 17:42:12

标签: ms-access access-vba

我试图让一个字段在Access 2007中有一个不同的字段有特定文本时放入某个名称。例如。

If [FieldName] = "mountain" then [FieldName2] ="Jack" but if [FieldName] = "ocean" then [FieldName2] ="John"

我找不到能给我这个结果的表达式。

1 个答案:

答案 0 :(得分:1)

最好将多个if-then语句更改为case / switch语句。

Select Case [Product Category]
    Case "Children"
        [Category Manager] = "John"
    Case "Hybrid"
        [Category Manager] = "Jack"
    Case "Leisure"
        [Category Manager] = "Sally"
    Case "Mtn."
        [Category Manager] = "Kelly"
    Case Else
        [Category Manager] = "Carl"
End Select