If then Else

T

TL

I have written the following If then else statement for a form. It makes
sure that 3 fields in a form add up to a seperate field before I go onto
another procedure. No matter what I do, it keeps skipping over this
statement. I can make sure that the fields add up to [Form].[Text41] one
time and not add up to it another and it still skips it.

Is there a better way of doing this??

If [Form].[Food Cost.SumofTrnValue] + [Form].[Pack Cost.SumofTrnValue] +
[Form].[Labor Costs.TrnValue] + [Form].[Freezing Costs.TrnValue] +
[Form].[Overhead Costs.TrnValue] <> [Form].[Text41] Then
MsgBox "The sum of Food Cost, Pack Cost, Labor Cost, Freezing Cost and
Overhead Cost does not add up to the Total Dollars Field", 0, "Addition
Error"
Cancel = True
frm("Text41").SetFocus
End
End If


Thanks!!

Tim
 
K

Ken Snell

Your code seems to be a bit jumbled? What is [Form].[Food
Cost.SumofTrnValue] supposed to be? and the other entries? Please explain a
bit more about this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top