Access query syntax error

leeb91

New Member
Joined
May 22, 2015
Messages
20
I am having trouble running this query and it is not clear to me why it won't run. So What I am trying to do is 1. Check if [_DATA].[Claim_Status] is null or not 2. if it is null, check indemnity_paid if it's > 0 and if it is, output "SETTLED". 3. If indemnity_paid is not > 0 , then it would check resolution date and if resolution date is greater than 1/1/1920, it will output "DISMISSED" and if the resolution date is not greater than 1/1/1920 or it is null , it should output "PENDING". Above was for blank status and I need to make changes for non-blank cells too. 1. Check if it is non-blank-cell that has either "CLOSED" or "CLOSED*". if the claim_status is either of those, it will check indemnity paid and if there is greater than 0 indemnity paid, it should output "SETTLED" and if it is not >0, it should output "DISMISSED". Can anyone leave comments regarding the code below? Thanks in advance!
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">Claim_Status: iif([_DATA].[Claim_Status] IS NULL,iif([_DATA].
[Indemnity_Paid]>0,"SETTLED",iif([_DATA].
[Resolution_Date]>#1/1/1920#,"DISMISSED","PENDING"),iif([_DATA].[Claim_Status]
IN ("CLOSED","CLOSED*","ADDMOREHERE"),iif([_DATA].
[Indemnity_Paid]>0,"SETTLED","DISMISSED"),[Status].[Claim_Status]))))</code>
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
you shouldnt use complex IIF statements in a query.
Either,
change this to a function to return your value
or
build a table and join it in the query to return your value
 
Upvote 0
Note also that if any of the values are missing, the IIF will not work as you expect based on what you have here.
 
Upvote 0
you shouldnt use complex IIF statements in a query.
Either,
change this to a function to return your value
or
build a table and join it in the query to return your value

what's the difference between putting the IIF statement directly in your query or putting it in a function and having your query call the function ?

is there really a speed difference or what ?
 
Upvote 0
and is this possible
IN("CLOSED","CLOSED*","ADDMOREHERE")

I didn't know you could put a wildcard in an "in" statement
 
Upvote 0
IsNull is a function and should be used like this IsNull([_DATA].[Claim_Status]).

Also, you can't use wildcards in an IN clause.
 
Upvote 0

Forum statistics

Threads
1,221,851
Messages
6,162,429
Members
451,765
Latest member
craigvan888

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top