Originally Posted by
MJays
Hi all,
In a report, if a value (date) is null, how do we write something like IIf Null, then enter the words "No Date Recorded", otherwise, enter dd mmmm", "yyyy
1. you shouldn't be having this kind of problem at report writing level. the best way to construct a report is to first get your output into one or more queries, arranged exactly the way you want them, then just load the queries into the report. it is way easier to fix problems in queries, to sort queries, to eliminate null values in queries, to set criteria in queries than it is to do any of those things in reports. don't think of a report as way to process data, but as a way to present data you have previously processed.
we assume your date field is called [valuedate] (note, as Bob Fitz said, it is not a good idea to have a field or control called simply "date", add something to it, like paydate, or birthdate, or whatever).
2. the IsNull() function tests for a null value, and returns True if it is Null, otherwise False. so IsNull([valuedate]) is True when the date is null.
3. in a query, the expression:
Code:
IIF(IsNull(valuedate]), "No Date Recorded", Format([valuedate], "dd mmmm yyyy"))
many thanks,
Cottonshirt