Calcsum wont work

Hello, I am in a bit of a problem and I have spent few hours trying to figure it out, but I havent been able to get it to work. Background Information On a form, I have a subform (which contains the following fields:- Transaction Type (option :- receipt, cheque), Date (date), Description (text), Amount (decimal)). Also on the form, there is a field called ‘Annual Allocation’. All, I had to do is look at all the Transaction type which are off type “Cheque” and add all of there ‘Amount’ fields. Once you have the totalsum of the Amounts field, compare it with ‘Annual Allocation’ field. If ‘amount’ is greater than ‘annual allocation’. Throw an error. IF Rec.“Transaction Type” = Rec.“Transaction Type”::Cheque THEN BEGIN lrecJob.GET(Rec.“Job No.”); lrecConsumerDisbursement.SETCURRENTKEY(“Transaction Type”); lrecConsumerDisbursement.SETRANGE(“Job No.”, Rec.“Job No.”); lrecConsumerDisbursement.SETRANGE(“Transaction Type”, “Transaction Type”::Cheque); lrecConsumerDisbursement.CALCSUMS(Amount); TotalAmount := lrecConsumerDisbursement.Amount+ Rec.Amount; IF lrecJob.“Annual Allocation” screencast.com/…/xtrQUutmFpu3

What’s the error message you’re receiving? I’m guessing it’s that you don’t have Job No. defined as a field in your key, but you are filtering on it. You can only use CALCSUMS when all of the filters applied are in the key.

It didnt post the whole post. Let me type it again. Rest of the code:- if lrecjob.“annual allocation”

for some weird reason it wont post the rest of the topic. So, I sent you a conversation (Matt) with the whole message so you can get a better understanding as to where I am coming from and maybe point me in the right direction.

Again, what’s the error message? What is the problem you are having with your code? Is it running all the way through but not giving the desired result? Throwing an error that it can’t calculate the sum? You need to provide full details about the issue you are having.

The code works, but its not giving the desired results. I have tried playing around with the code for hours, but still havent been able to get the desired outcome.