Hi
I've been trying my hand at creating a few functions and all has gone well.
However, one function will simply not work and I'm baffled.
Below are two functions that I have created which are very similar. The first, ROS, works perfectly well in queries and returns the expected result. The second, BrCov always returns 999.
I've checked the field properties in the table and all have the same properties: Data Type = Number, Field Size = Integer, Format = Fixed, Decimal Places = 0, Default Value = 0.
Would very much appreciate comments.
Thanks
David
Public Function ROS(Sales_Units, Number_Of_Stores As Double)
If Sales_Units = 0 Then
ROS = 0
ElseIf Number_Of_Stores = 0 Then
ROS = 0
Else
ROS = Format(Sales_Units / Number_Of_Stores, "Standard")
End If
End Function
Public Function BrCov(Stock, Sales As Double)
If Stock = 0 Then
BrCov = 999
ElseIf Sales_Units = 0 Then
BrCov = 999
Else
BrCov = Format(Stock / Sales, "Standard")
End If
End Function
I've been trying my hand at creating a few functions and all has gone well.
However, one function will simply not work and I'm baffled.
Below are two functions that I have created which are very similar. The first, ROS, works perfectly well in queries and returns the expected result. The second, BrCov always returns 999.
I've checked the field properties in the table and all have the same properties: Data Type = Number, Field Size = Integer, Format = Fixed, Decimal Places = 0, Default Value = 0.
Would very much appreciate comments.
Thanks
David
Public Function ROS(Sales_Units, Number_Of_Stores As Double)
If Sales_Units = 0 Then
ROS = 0
ElseIf Number_Of_Stores = 0 Then
ROS = 0
Else
ROS = Format(Sales_Units / Number_Of_Stores, "Standard")
End If
End Function
Public Function BrCov(Stock, Sales As Double)
If Stock = 0 Then
BrCov = 999
ElseIf Sales_Units = 0 Then
BrCov = 999
Else
BrCov = Format(Stock / Sales, "Standard")
End If
End Function