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?
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?
コメント
2件のコメント
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,
投稿コメントは受け付けていません。