コミュニティ

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?

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

2件のコメント

  • 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

投稿コメントは受け付けていません。