In a form called FormSample we have embedded drop down list that when selected use various tables, for example one will use Asbestos Type, Conditions, Treatments etc…., when you select an option form these drop down lists the selection as a score against them.
The score is placed in a control on the form called SampleMaterialRisk which uses a Control source as Expression builder and in here is the expression SampleMaterialRisk
On all drop down list the After Update as Expression builder and in it is =CalcMaterialRisk() The Function code for this is
Private Function CalcMaterialRisk()
On Error GoTo Incomplete
Dim lists(6) As String
lists(0) = "ListAnalysis"
lists(1) = "ListAsbestosType"
lists(2) = "ListCondition"
lists(3) = "ListFriability"
lists(4) = "ListPosition"
lists(5) = "ListTreatment"
Dim rs(6) As Integer
rs(0) = ComboSampleAnalysisID.Value
rs(1) = ComboSampleAsbestosTypeID.Value
rs(2) = ComboSampleConditionID.Value
rs(3) = ComboSampleFriabilityID.Value
rs(4) = ComboSamplePositionID.Value
rs(5) = ComboSampleTreatmentID.Value
Dim risk As Byte
risk = 0
For n = 0 To 5
risk = risk + GetFactor(lists, rs)
Next n
SampleMaterialRisk = risk
TextMaterialRiskString = "(" & Mod_Custom.MaterialRiskString(risk) & ")"
Exit Function
Incomplete:
SampleMaterialRisk = Null
TextMaterialR
I have 2 questions
1.I don’t quite understand how it gets the total figure could someone explain
2.If we wanted it not to allow the calculation to never be greater than 12 , how can we stop it going over 12 using the code above (if that is possible)
Thanks
The score is placed in a control on the form called SampleMaterialRisk which uses a Control source as Expression builder and in here is the expression SampleMaterialRisk
On all drop down list the After Update as Expression builder and in it is =CalcMaterialRisk() The Function code for this is
Private Function CalcMaterialRisk()
On Error GoTo Incomplete
Dim lists(6) As String
lists(0) = "ListAnalysis"
lists(1) = "ListAsbestosType"
lists(2) = "ListCondition"
lists(3) = "ListFriability"
lists(4) = "ListPosition"
lists(5) = "ListTreatment"
Dim rs(6) As Integer
rs(0) = ComboSampleAnalysisID.Value
rs(1) = ComboSampleAsbestosTypeID.Value
rs(2) = ComboSampleConditionID.Value
rs(3) = ComboSampleFriabilityID.Value
rs(4) = ComboSamplePositionID.Value
rs(5) = ComboSampleTreatmentID.Value
Dim risk As Byte
risk = 0
For n = 0 To 5
risk = risk + GetFactor(lists, rs)
Next n
SampleMaterialRisk = risk
TextMaterialRiskString = "(" & Mod_Custom.MaterialRiskString(risk) & ")"
Exit Function
Incomplete:
SampleMaterialRisk = Null
TextMaterialR
I have 2 questions
1.I don’t quite understand how it gets the total figure could someone explain
2.If we wanted it not to allow the calculation to never be greater than 12 , how can we stop it going over 12 using the code above (if that is possible)
Thanks