Query for Combined Functions Incl Date ?

KarenYT
3StarLounger
Posts: 212
Joined: 28 Mar 2011, 18:29
Location: Netherlands

Query for Combined Functions Incl Date ?

Post by KarenYT »

Good Day,

MS Office 2016 - Access
I have a pretty complicated Field as follows :

I want create a query from 2 tables: [12inventoryAllStatus] and [14Dormant]. [LastCOdate] is in both tables.
and I want to create a new Column "Excess" in the new query to pickup the criteria of column "preExcess" by using the following functions, but the date column "LastCOdate" does not work, the new column "Excess" still shows all the dates pertaining to "preExcess". The "Excess" only works for the function of "429" or "D".

Excess: IIf([429usage]="429" Or [AA-Part]="AA" Or [Dormant]="D" Or ([12inventoryAllStatus]![LastCOdate])<=1/1/2015,"",[preExcess])

Please help !
Thanks
Karen

User avatar
HansV
Administrator
Posts: 78591
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Query for Combined Functions Incl Date ?

Post by HansV »

Literal dates in a query must be enclosed in # characters:

Excess: IIf([429usage]="429" Or [AA-Part]="AA" Or [Dormant]="D" Or ([12inventoryAllStatus]![LastCOdate])<=#1/1/2015#,"",[preExcess])
Best wishes,
Hans

KarenYT
3StarLounger
Posts: 212
Joined: 28 Mar 2011, 18:29
Location: Netherlands

Re: Query for Combined Functions Incl Date ?

Post by KarenYT »

Great !
I just didn't think of the # sign !!
Thanks a lot, Hans !