Hi,
I have a table containing part entries for a part.
Each part entry has a percentage and I want to issue a warning when the sum of percentages for a part exceeds 100.
The data type for the percentage field is Double.
The problem is that I have entered 2 parts and several part entries for each part. Both percentage sums add up to 100 but on one of the parts, the warning code is running as if it is over 100. Here is the code...
I can absolutely assure you that the DSum("Percentage", "tPartEntry", "PartID = " & Me.txtParentRecordID) is 100. I have tested this on a calculator and by running a group query and entering it into the intermediate window. All results say 100.
Does anyone know why one part with entry percentages totalling 100 gets past this code but the other does not?
I have a table containing part entries for a part.
Each part entry has a percentage and I want to issue a warning when the sum of percentages for a part exceeds 100.
The data type for the percentage field is Double.
The problem is that I have entered 2 parts and several part entries for each part. Both percentage sums add up to 100 but on one of the parts, the warning code is running as if it is over 100. Here is the code...
Code:
[green] 'check the total percent and warn if over 100[/green]
Dim p As Double
p = DSum("Percentage", "tPartEntry", "PartID = " & Me.txtParentRecordID)
If p > 100 Then
msgBox "Please note that the total percentage is over 100%"
End If
I can absolutely assure you that the DSum("Percentage", "tPartEntry", "PartID = " & Me.txtParentRecordID) is 100. I have tested this on a calculator and by running a group query and entering it into the intermediate window. All results say 100.
Does anyone know why one part with entry percentages totalling 100 gets past this code but the other does not?