访问报告 - 动态设置ControlSource

时间:2014-09-26 12:43:29

标签: ms-access access-vba report

我的MS Access报告中有一个场景,其中特定文本框的ControlSource可能会根据绑定到该报告的字段的值而有所不同。

例如:

If VALUE = 1 then Me.txtFeesAndExpenses.ControlSource = "The following fees for this specific scenario are " & FEE_VALUE End if

OR

If VALUE = 2 then Me.txtFeesAndExpenses.ControlSource = "The following fees for this OTHER specific scenario are " & FEE_VALUE End if

我无法将此代码放在我的报告中,以便将正确的值绑定到文本框。

1 个答案:

答案 0 :(得分:1)

更容易使用计算字段并在设计模式中设置ControlSource

 ="The following fees for " & SWITCH(VALUE=1,"THIS",value=2,"OTHER",true," ERROR ")
    & " specific scenario are " & FEE_VALUE