View Single Post
  #4  
Old May 23rd, 2010, 01:40 AM posted to microsoft.public.access.queries
theref147
external usenet poster
 
Posts: 3
Default Coditional IIf with an AND/OR statement

I tried to copy this into the query but kept comming up with invalide use of
] or !. Can this also do the other provinces within the same field? This
field name is TaxRate.

"Douglas J. Steele" wrote:

You may find it easier to write a function and pass the Province and Date as
parameters to the function...

Reading between the lines, try something like:

Switch([Prov] = 'BC', IIf([Date of Service] #2010-06-30#, .12, .05),
[Prov] = 'ON', IIf([Date of Service] #2010-06-30#, .13, .05),

....
)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"theref147" wrote in message
...
Trying to get a query to determine a tax rate based on the province on a
record.
It should look at the [Prov] field and based on what is in that field come
up with the corresponding tax rate. eg IIf ([Prov]= "ON" and [Date of
Service]2010/06/30,.13,.05, OR IIf ([Prov]="BC" and [Date of
Service]2010/06/30,.12,.05) or something of this nature. I am not sure
how
to write the formula could someone help.



.