0

我需要这些公式的帮助,我尝试使用这个,但它告诉我它太长了

=IIf([Combo5]=“建筑服务工程师”,[Forms]![Estimate]![Text787],IIf([Combo5]=“Carpenter”,[Forms]![Estimate]![Text788],IIf([ Combo5]=“保管人”,[Forms]![Estimate]![Text789],IIf([Combo5]=“保管人 - 轮班工资 (5am - 6am)”,[Forms]![Estimate]![Text790],IIf ([Combo5]=“电工”,[Forms]![Estimate]![Text791],IIf([Combo5]=“设施项目主管”,[Forms]![Estimate]![Text792],IIf([Combo5] =“消防元帅”,[Forms]![Estimate]![Text793],IIf([Combo5]=“园艺专家”,[Forms]![Estimate]![Text794],IIf([Combo5]=“Grounds Worker” ”,[Forms]![Estimate]![Text795],IIf([Combo5]=“室内设计”,[Forms]![Estimate]![Text796],IIf([Combo5]=“灌溉专家”,[Forms ]![Estimate]![Text797],IIf([Combo5]=“Laborer”,[Forms]![Estimate]![Text798],IIf([Combo5]=“Lead Auto/Equip Mechanic”,[Forms]! [Estimate]![Text799],IIf([Combo5]=“Lead Custodian”,[Forms]![Estimate]![Text800],IIf([Combo5]=“Lead Grounds Worker”,[Forms]![Estimate]![Text801],IIf([Combo5]=“Light Auto/Equip Operator”,[Forms]! [Estimate]![Text802],IIf([Combo5]=“Locksmith”,[Forms]![Estimate]![Text803],IIf([Combo5]=“Maintenance Mechanic”,[Forms]![Estimate]![ Text804],IIf([Combo5]=“Painter”,[Forms]![Estimate]![Text805],IIf([Combo5]=“害虫防治专家”,[Forms]![Estimate]![Text806],IIf ([Combo5]=“管道工”,[Forms]![Estimate]![Text807],IIf([Combo5]=“Recycler (Laborer)”,[Forms]![Estimate]![Text808],IIf([Combo5 ]=“制冷机械师”,[Forms]![Estimate]![Text809],IIf([Combo5]=“Supervising Building Service Engineer”,[Forms]![Estimate]![Text810],0))))) )))))))))))))))))))))[Forms]![Estimate]![Text803],IIf([Combo5]=“维修技工”,[Forms]![Estimate]![Text804],IIf([Combo5]=“Painter”,[Forms]![估计]![Text805],IIf([Combo5]=“害虫防治专家”,[Forms]![Estimate]![Text806],IIf([Combo5]=“水管工”,[Forms]![Estimate]![ Text807],IIf([Combo5]=“Recycler (Laborer)”,[Forms]![Estimate]![Text808],IIf([Combo5]=“Refrigeration Mechanic”,[Forms]![Estimate]![Text809] ,IIf([Combo5]=“Supervising Building Service Engineer”,[Forms]![Estimate]![Text810],0)))))))))))))))))))))) ))[Forms]![Estimate]![Text803],IIf([Combo5]=“维修技工”,[Forms]![Estimate]![Text804],IIf([Combo5]=“Painter”,[Forms]![估计]![Text805],IIf([Combo5]=“害虫防治专家”,[Forms]![Estimate]![Text806],IIf([Combo5]=“水管工”,[Forms]![Estimate]![ Text807],IIf([Combo5]=“Recycler (Laborer)”,[Forms]![Estimate]![Text808],IIf([Combo5]=“Refrigeration Mechanic”,[Forms]![Estimate]![Text809] ,IIf([Combo5]=“Supervising Building Service Engineer”,[Forms]![Estimate]![Text810],0)))))))))))))))))))))) ))IIf([Combo5]=“制冷机械师”,[Forms]![Estimate]![Text809],IIf([Combo5]=“Supervising Building Service Engineer”,[Forms]![Estimate]![Text810],0) )))))))))))))))))))))))))))))))IIf([Combo5]=“制冷机械师”,[Forms]![Estimate]![Text809],IIf([Combo5]=“Supervising Building Service Engineer”,[Forms]![Estimate]![Text810],0) )))))))))))))))))))))))))))))))

所以我把它当作一个 SWITCH 函数

=Switch([Combo5]=“建筑服务工程师”,[Forms]![Estimate]![Text787],[Combo5]=“Carpenter”,[Forms]![Estimate]![Text788],[Combo5]=“保管人”,[Forms]![Estimate]![Text789],[Combo5]=“保管人 - 轮班工资 (5am - 6am)”,[Forms]![Estimate]![Text790],[Combo5]=“Electrician” ,[Forms]![Estimate]![Text791],[Combo5]=“设施项目主管”,[Forms]![Estimate]![Text792],[Combo5]=“Fire Marshal”,[Forms]![Estimate ]![Text793],[Combo5]=“园艺专家”,[Forms]![Estimate]![Text794],[Combo5]=“Grounds Worker”,[Forms]![Estimate]![Text795],[Combo5 ]=“室内设计”,[Forms]![Estimate]![Text796],[Combo5]=“灌溉专家”,[Forms]![Estimate]![Text797],[Combo5]=“Laborer”,[Forms ]![Estimate]![Text798],[Combo5]=“Lead Auto/Equip Mechanic”,[Forms]![Estimate]![Text799],[Combo5]=“Lead Custodian”,[Forms]![Estimate] ![Text800],[Combo5]=“Lead Grounds Worker”,[Forms]![Estimate]![Text801],[Combo5]=“Light Auto/Equip Operator”,[Forms]![Estimate]![Text802],[Combo5]=“Locksmith”,[Forms]![Estimate ]![Text803],[Combo5]=“维修技工”,[Forms]![Estimate]![Text804],[Combo5]=“Painter”,[Forms]![Estimate]![Text805],[Combo5] =“害虫防治专家”,[Forms]![Estimate]![Text806],[Combo5]=“Plumber”,[Forms]![Estimate]![Text807],[Combo5]=“Recycler (Laborer)”, [Forms]![Estimate]![Text808],[Combo5]=“Refrigeration Mechanic”,[Forms]![Estimate]![Text809],[Combo5]=“Supervising Building Service Engineer”,[Forms]![Estimate ]![Text810])[Estimate]![Text806],[Combo5]=“Plumber”,[Forms]![Estimate]![Text807],[Combo5]=“Recycler (Laborer)”,[Forms]![Estimate]![Text808] ,[Combo5]=“制冷机械师”,[Forms]![Estimate]![Text809],[Combo5]=“Supervising Building Service Engineer”,[Forms]![Estimate]![Text810])[Estimate]![Text806],[Combo5]=“Plumber”,[Forms]![Estimate]![Text807],[Combo5]=“Recycler (Laborer)”,[Forms]![Estimate]![Text808] ,[Combo5]=“制冷机械师”,[Forms]![Estimate]![Text809],[Combo5]=“Supervising Building Service Engineer”,[Forms]![Estimate]![Text810])

那没用,所以我将其用作模块

Option Compare Database
Public Function fncRetValBasedOnCmb4() As String
Select Case Forms!ReportFinished!Combo4
    Case "Building Service Engineer"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text787
    Case "Carpenter"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text788
    Case "Custodian"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text789
    Case "Custodian - Shift Pay (5am - 6am)"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text790
    Case "Electrician"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text791
    Case "Facilities Project Supervisor"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text792
    Case "Fire Marshal"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text793
    Case "Gardening Specialist"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text794
    Case "Grounds Worker"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text795
    Case "Interior Design"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text796
    Case "Irrigation Specialist"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text797
    Case "Laborer"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text798
    Case "Lead Auto/Equip Mechanic"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text799
    Case "Lead Custodian"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text800
    Case "Lead Grounds Worker"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text801
    Case "Light Auto/Equip Operator"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text802
    Case "Locksmith"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text803
    Case "Maintenance Mechanic"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text804
    Case "Painter"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text805
    Case "Pest Control Specialist"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text806
    Case "Plumber"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text807
    Case "Recycler (Laborer)"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text808
    Case "Refrigeration Mechanic"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text809
    Case "Supervising Building Service Engineer"
        fncRetValBasedOnCmb4 = Forms!Estimate!Text810
    Case Else
        fncRetValBasedOnCmb4 = 0
End Select

结束功能

问题是我不知道如何触发这个


我有一个输入数据的表单,我试图创建一个带有几个组合框的新表单,一旦选择,它将显示未绑定文本框中关联的数量(第一个表单的计算字段)

4

1 回答 1

0

如何放置公式:

=fncRetValBasedOnCmb4()

在未绑定文本框的控制源中?

于 2013-08-19T07:58:43.540 回答