If then else Sql statements HELP

E

Erin Freeman

Here is the situation.

I have a list of hospitals. Not all of the hospitals can be charged GST for
wages

Here is my sql:
GST Wage Total: IIf([D GST Applicable Wage]=Yes,[Billing Sub-Total]*[D
Billable GST],0)
This gives me the amount of GST based on the GST amount and the Billing
SubTotal - This works, now...

..........I need an else statement to go with the above but i cant seem to
get the syntax right to add and "Else" in there
If [D GST Applicable wage]=No then GST Wage Total = 0 so there is a value
in the field for my final calculations.......

Thanks in advance
 
G

George Nicholson

A) IIf([D GST Applicable Wage]=Yes,[Billing Sub-Total]*[D Billable GST],0)
B) If [D GST Applicable wage]=No then GST Wage Total = 0

B is already present in A:
IIF(T/F expression, result if True, result if False)

If that's not the result you are seeing, then I think additional specifics
are needed (what "wrong" results do you get with what specific input
values..)

you could try:
iif(nz([D GST Applicable Wage], "") = Yes, ... etc
just in case Null values are gumming up the works, but I wouldn't think that
should be necessary.

HTH,

Erin Freeman said:
Here is the situation.

I have a list of hospitals. Not all of the hospitals can be charged GST
for
wages

Here is my sql:
GST Wage Total: IIf([D GST Applicable Wage]=Yes,[Billing Sub-Total]*[D
Billable GST],0)
This gives me the amount of GST based on the GST amount and the Billing
SubTotal - This works, now...

.........I need an else statement to go with the above but i cant seem to
get the syntax right to add and "Else" in there
If [D GST Applicable wage]=No then GST Wage Total = 0 so there is a value
in the field for my final calculations.......

Thanks in advance
 

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