Access Syntax Error (Missing Operator)

toilettenseife

New Member
Joined
Oct 2, 2015
Messages
13
Access is giving me a syntax error on this section of code. I keep looking at it and I can't see what's wrong. Any ideas?

IIf([Closed Order File].[LOGISTICS DELIVERY DATE_CS] Is Null,'Supplier Receipt Date',
IIf([Closed Order File].[LOGISTICS DELIVERY DATE_CS] Is Null And [Closed Order File].[SUPPLIER_RECEIPT_DATE] Is Null, 'Logistics P/U Date',
IIf([Closed Order File].[LOGISTICS DELIVERY DATE_CS] Is Null And [Closed Order File].[SUPPLIER_RECEIPT_DATE] Is Null And
[Closed Order File].[LOGISTICS P/U DATE_CS] Is Null,'Customer Ship Date',
IIf([Closed Order File].[LOGISTICS DELIVERY DATE_CS] Is Null And [Closed Order File].[SUPPLIER_RECEIPT_DATE] Is Null And
[Closed Order File].[LOGISTICS P/U DATE_CS] Is Null And [Closed Order File].[CUSTOMER_SHIPMENT_DATE] Is Null,'PO/RO Create Date',
'Logistics Delivery Date')))) AS Receipt_Date_Used,
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
The syntax looks fine to me, provided that all your field references are correct and are available.
How do you know it is this part that is causing issues?

Usually, if I mind a problem like this, I will proceed by doing the following:
- Remove the calculated field from the query entirely, and see if it works.
- If it does, then rebuild the calculated expression one IIF at a time (just trying doing the first level, and see if that works)
- If it works, continue on, and add the next level.
- Continue until you find the error.
 
Upvote 0
Can you explain the logic behind the expression?
 
Upvote 0
Can you explain the logic behind the expression?

Sometimes dates are missing from my data. If the date I need is missing, I want use an earlier one. However, all this is happening behind the scenes. This expression was created to notify the user of the date that was used.
 
Upvote 0
I don't know about the missing operator, but I don't see how the code should do what you want

maybe I'm missing something, but doesn't an IIf statement work this way

iif ( condition is true, do this, otherwise do this ...

so let's say the first condition is false
meaning
[LOGISTICS DELIVERY DATE_CS] is not null --- it actually has data

since the condition is false the iif will jump to the "otherwise" part -- the next iif

but look at the next iif
its checking to see if [LOGISTICS DELIVERY DATE_CS] is null

and we already know its not

so I'm confused how this is supposed to work

Rich (BB code):
If
( 
  [Closed Order File].[LOGISTICS DELIVERY DATE_CS] Is Null, 
  'Supplier Receipt Date',
  IIf
  (
    [Closed Order File].[LOGISTICS DELIVERY DATE_CS] Is Null And [Closed Order File].[SUPPLIER_RECEIPT_DATE] Is Null, 
    'Logistics P/U Date',


 
Upvote 0

Forum statistics

Threads
1,221,780
Messages
6,161,887
Members
451,730
Latest member
BudgetGirl

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