Community

Validation Script [FlexiCap11, Dist]

Hi, probably super easy for someone. My goal is to multiply the "quantity" by the "unit price" to make sure it equals the "linetotal". Below is what I've tried so far. This returns "Line total out of balance" for all fields though. I suspected perhaps a formatting issue but any attempt to use something like "FormatNumber" has had no effect.

if me.Field("Quantity").Value * me.Field("UnitPrice").Value = me.Field("LineTotal").Value then
me.CheckSucceeded = true
else
me.CheckSucceeded = false
me.ErrorMessage = "Line total out of balance!"
end if

Any suggestions?

Was this article helpful?

0 out of 0 found this helpful

Comments

2 comments

  • Avatar
    Alberto Torino
    Hi Mike:
    Try using Ccur to convert field values.

    if Ccur(me.Field("Quantity").Value) * CCur( me.Field("UnitPrice").Value )= Ccur(me.Field("LineTotal").Value) then
    me.CheckSucceeded = true
    else
    me.CheckSucceeded = false
    me.ErrorMessage = "Line total out of balance!"
    end if

    You can use Cint for field Quantity

    Regards,
    0
  • Avatar
    Permanently deleted user
    CCur did the trick. Thank you!
    0

Post is closed for comments.