Hello:
I have a function that I created that returns the single sample weight of each material that is selected
My function accepts 5 arguments:
1)matType-The material the user has selected
2)batchWeight-The batchweight of each material used
3)SumCem-Sum of the cement material batchweights used
4)CemSingWt- Sum of cement single sample weight
5)pigPercent- the percent of pigments being used
Here is my function:
Public Function GetSingleWeight (matType As Integer, BatchWeight As Double, SumCem As Double, CemSingWt As Double, PigPerc As Double) As Double
'returns the single sample weight of each material in the 'DM_SingleSampW t' calculation
Select Case matType
'Cement
Case 1
GetSingleWeight = BatchWeight / 164.5
Case 2, 3
'Course, Fine
GetSingleWeight = CemSingWt / SumCem * BatchWeight
Case 4
'Pigment
GetSingleWeight = CemSingWt * 453.5924 * PigPerc
End Select
End Function
I have an unbound text box on my continuous subform called DM_SingleSampWt . the control source for this text box is:
The problem is that only some of my Cases are being calculated. Cases 1, 2 and 3 do not work. I am receiving a #Error, error. If you notice, all of my cases do not use the same arguments, but I know it's necessary to have them when I call my function.
If you can offer any assistance, I would appreciate it.
Thank You
I have a function that I created that returns the single sample weight of each material that is selected
My function accepts 5 arguments:
1)matType-The material the user has selected
2)batchWeight-The batchweight of each material used
3)SumCem-Sum of the cement material batchweights used
4)CemSingWt- Sum of cement single sample weight
5)pigPercent- the percent of pigments being used
Here is my function:
Public Function GetSingleWeight (matType As Integer, BatchWeight As Double, SumCem As Double, CemSingWt As Double, PigPerc As Double) As Double
'returns the single sample weight of each material in the 'DM_SingleSampW t' calculation
Select Case matType
'Cement
Case 1
GetSingleWeight = BatchWeight / 164.5
Case 2, 3
'Course, Fine
GetSingleWeight = CemSingWt / SumCem * BatchWeight
Case 4
'Pigment
GetSingleWeight = CemSingWt * 453.5924 * PigPerc
End Select
End Function
I have an unbound text box on my continuous subform called DM_SingleSampWt . the control source for this text box is:
Code:
=GetSingleWeight([cbo_matTypeID],[matBatchWeight],[txtCemSum],[txtCemSing],[txtPigPercent])
If you can offer any assistance, I would appreciate it.
Thank You
Comment