I can get the code in the attached snippet to work when I do not use an And in the statement that allows me to look at more then one COM_TYPE value, but when I do the following no dates appear in the "Recent Check" field of the Access reports. So, If I add this code it doesn't work:
=IIf([COMP_TYPE]="COM",IIf([Date_032] Is Null,IIf([Date_031] Is Null,IIf([Date_030] Is Null,IIf([Date_029] Is Null,[Date_029],[Date_029]),[Date_030]),[Date_031]),[Date_032])) And
IIf([COMP_TYPE]="MFD",IIf([Date_039] Is Null,IIf([Date_038] Is Null,IIf([Date_037] Is Null,IIf([Date_036] Is Null,[Date_036],[Date_036]),[Date_037]),[Date_038]),[Date_039]))
but, this returns data no problem -
=IIf([COMP_TYPE]="COM",IIf([Date_032] Is Null,IIf([Date_031] Is Null,IIf([Date_030] Is Null,IIf([Date_029] Is Null,[Date_029],[Date_029]),[Date_030]),[Date_031]),[Date_032]))
I'm trying to retrieve the last date entered as depicted in the snapshots I sent you. The data is inputted via our Permits application and I'm trying to grab the 1st, 2nd, 3rd, or maybe the forth date entered, if it is the last one entered. So if it is the 3rd field that was the last used, the forth would be null.
The code in Slide3.GIF was returning no recent data, then I tried this code and it gives me the dates for COMP_TYPE=COM but if I use "And" I get nothing again. So the question is how can I have multiple COMP_TYPE(s) using And?
See attached snapshots.
=IIf([COMP_TYPE]="COM",IIf([Date_032] Is Null,IIf([Date_031] Is Null,IIf([Date_030] Is Null,IIf([Date_029] Is Null,[Date_029],[Date_029]),[Date_030]),[Date_031]),[Date_032])) And IIf([COMP_TYPE]="MFD",IIf([Date_039] Is Null,IIf([Date_038] Is Null,IIf([Date_037] Is Null,IIf([Date_036] Is Null,[Date_036],[Date_036]),[Date_037]),[Date_038]),[Date_039]))
The And you're writing is after the End of the first If statement so it's irrelevent from a syntax point of view, and it's also irrelevent from a logical point of view, because either COMP_TYPE=COM or COMP_TYPE=MFD.
I don't know if I understood what you want to do exactly, but I can suggest the following:
=IIf([COMP_TYPE]="COM",IIf([Date_032] Is Null,IIf([Date_031] Is Null,IIf([Date_030] Is Null,IIf([Date_029] Is Null,[Date_029],[Date_029]),[Date_030]),[Date_031]),[Date_032]),IIf([COMP_TYPE]="MFD", IIf([Date_039] Is Null,IIf([Date_038] Is Null,IIf([Date_037] Is Null,IIf([Date_036] Is Null,[Date_036],[Date_036]),[Date_037]),[Date_038]),[Date_039])))
The test if COMP_TYPE="MFD" is carried if COMP_TYPE not = "COM"
IIf([COMP_TYPE]="MFD",)
Not the solution you were looking for?
IT issues often require a personalized solution. With Ask the Experts™, submit your questions to our certified professionals and receive unlimited, customized solutions that work for you.
Premium Content
You need an Expert Office subscription to comment.Start Free Trial