Undefined function IF in Expression

K

KrispyData

I am trying to use this funcition in a query. Access is giving me the
message that I put in the subject line of this question. What appears to be
wrong with the function? The reason I am doing this is because I want a 0 to
appear instead of error message if the denominator is 0.

IF([t_OCProfit_FINAL]![NF_Sales]=0,0,([t_OCProfit_FINAL]![NF_Sales]/[t_OCProfit_FINAL]![OC_Sales]))
 
K

KenSheridan via AccessMonster.com

It should be IIF not IF. The latter is an Excel function used in the same
way. Its also the first part of an 'If...Then...Else…End If' Statement in VBA.


But in any case shouldn't it be:

IF([t_OCProfit_FINAL].[OC_Sales]=0,0,([t_OCProfit_FINAL].[NF_Sales]/
[t_OCProfit_FINAL]![OC_Sales]))

to avoid the division by zero?

Ken Sheridan
Stafford, England
I am trying to use this funcition in a query. Access is giving me the
message that I put in the subject line of this question. What appears to be
wrong with the function? The reason I am doing this is because I want a 0 to
appear instead of error message if the denominator is 0.

IF([t_OCProfit_FINAL]![NF_Sales]=0,0,([t_OCProfit_FINAL]![NF_Sales]/[t_OCProfit_FINAL]![OC_Sales]))
 

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