Iif Statement - error message wrong number of arguments

G

Guest

I am a relatively new access user so my apologies if this seems trivial I
have tried looking through other posting but can’t seem to find an answer to
my problem. I am using Access 2002

I am trying to create an iif statement on a report using a text box. Under
the control source I am tried to enter

=IIf(([Expense Code] like "01*",,"",([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like '01*',"",([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like "01*",0,([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like '01*',0,([Expended in Report Period]/20)*4))

[Expense Code] is a text field, [Expended in Report Period] is a field from
query

I only want to calculate if Expense Code is not 01*, I have other expense
codes like 02, 03 etc

I am getting the message “The expression you entered has a function
containing the wrong number of argumentsâ€.

Thank you in advanced for any assistance.
 
K

Ken Snell [MVP]

Try this one:

=IIf([Expense Code] like "01*",0,([Expended in Report Period]/20)*4)
 
G

Guest

Thank you for your prompt response, it works perfectly.

Ken Snell said:
Try this one:

=IIf([Expense Code] like "01*",0,([Expended in Report Period]/20)*4)

--

Ken Snell
<MS ACCESS MVP>

JGus said:
I am a relatively new access user so my apologies if this seems trivial I
have tried looking through other posting but can't seem to find an answer
to
my problem. I am using Access 2002

I am trying to create an iif statement on a report using a text box. Under
the control source I am tried to enter

=IIf(([Expense Code] like "01*",,"",([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like '01*',"",([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like "01*",0,([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like '01*',0,([Expended in Report Period]/20)*4))

[Expense Code] is a text field, [Expended in Report Period] is a field
from
query

I only want to calculate if Expense Code is not 01*, I have other expense
codes like 02, 03 etc

I am getting the message "The expression you entered has a function
containing the wrong number of arguments".

Thank you in advanced for any assistance.
 
F

fredg

I am a relatively new access user so my apologies if this seems trivial I
have tried looking through other posting but canÿt seem to find an answer to
my problem. I am using Access 2002

I am trying to create an iif statement on a report using a text box. Under
the control source I am tried to enter

=IIf(([Expense Code] like "01*",,"",([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like '01*',"",([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like "01*",0,([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like '01*',0,([Expended in Report Period]/20)*4))

[Expense Code] is a text field, [Expended in Report Period] is a field from
query

I only want to calculate if Expense Code is not 01*, I have other expense
codes like 02, 03 etc

I am getting the message ´The expression you entered has a function
containing the wrong number of arguments¡.

Thank you in advanced for any assistance.

Or .. How about:
=IIf(Left([Expense Code],2) = "01","",[Expended in Report
Period]/20*4)
 
L

Lance

JGus said:
I am a relatively new access user so my apologies if this seems trivial I
have tried looking through other posting but can’t seem to find an answer to
my problem. I am using Access 2002

I am trying to create an iif statement on a report using a text box. Under
the control source I am tried to enter

=IIf(([Expense Code] like "01*",,"",([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like '01*',"",([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like "01*",0,([Expended in Report Period]/20)*4))
=IIf(([Expense Code] like '01*',0,([Expended in Report Period]/20)*4))

[Expense Code] is a text field, [Expended in Report Period] is a field from
query

I only want to calculate if Expense Code is not 01*, I have other expense
codes like 02, 03 etc

I am getting the message “The expression you entered has a function
containing the wrong number of argumentsâ€.

Thank you in advanced for any assistance.

Your statement should be
=IIf([Expense Code] like '01*',0,([Expended in Report Period]/20)*4)

you had too many brackets in the wrong place.
 

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