Your program looks fine, just make sure your program is actually "Calling" the subroutine when it is supposed to. Example:
On element entry of a command button:
CalculateInv() //Used to run the subroutine program
Also, you may want to throw in some "writeln's" here and there to get a view of whats happening. Example:
SubRoutine CalculateInv()
Var vCount as Int
Var vTotal as Double
Var vRecord as Int
vRecord = 1 //Record variable
vCount = @FormResultSetTotal("Bwr Items")
writeln("Line Item count = " +vCount)
If vCount > 0 Then
{
While vRecord <= vCount
{
writln("Calculating Item Number "+vRecord)
//Loop through subrecords adding up totals.
vTotal = vTotal + @TM(@FormFieldValue("Bwr Items", "Amount", vRecord))
writeln("Total so far is "+vTotal)
vRecord = vRecord + 1
}
//Place values in elements on form
LE25 = vTotal
}
End SubRoutine
If it still isn't working, then you may have a spelling error when referring to the subform name, LE name, etc. Something simple like that.

Steve