Hello Celeste
If you are using a query and want to select only those records where the expression is true, then add the expression to the WHERE clause of your query. For example:
SELECT * FROM [YourTable] WHERE [DATE RECEIVED] =[DATE OF LOSS];
You can also use the query design grid and enter <=[DATE OF LOSS] in the criteria cell for the DATE RECEIVED column.
If you wish to show all your records, but add a column showing a value depending on whether or not the expression is true, then use the IIf function, which works like this:
IIf( <conditional expression>, <value if true>, <value if false> )
To use your example,
ReceivedBeforeLoss: IIf([DATE RECEIVED] =[DATE OF LOSS], "True", "False" )
All the best,
Graham Mandeno [Access MVP 1996-2014]
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of celestecpa
Sent: Tuesday, 29 July 2014 10:04
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] If DATE1 < DATE2
I have an Access data base with several fields using dates. I need to find out if DATE RECEIVED is less than or equal to DATE OF LOSS. Can someone help, please? Would I use a query? Do I put the expression in the Criteria? Do I put a VBA expression in the properties? How would I get, let's say, the word "True" in another field if the expression was correct? I need to run this for 12,000 line items.
I appreciate any help you can give me.
Thanks in advance,
Celeste
Posted by: "Graham Mandeno" <graham@mandeno.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar