Thread: IIf statement
View Single Post
  #6  
Old August 19th, 2009, 03:19 PM posted to microsoft.public.access.reports
jmoore[_2_]
external usenet poster
 
Posts: 81
Default IIf statement

Wish I could do a "Reply to all" for such great response and tips. I
realized after trying the suggestions that I needed to write this as equals
not null. The code below displays the correct information when the two
fields match. However, when they do not, all that displays is a series of
pound signs (########). No text displays at all.

=IIf([EndDate]=[BeginDate],"Review Completed on: " & [BeginDate],"Review
Completed From " & [BeginDate] & " to " & [EndDate])

Thanks.

"fredg" wrote:

On Tue, 11 Aug 2009 08:18:01 -0700, jmoore wrote:

I would like one of two different statements to display on a report based on
whether one field is null. The two fields are BeginDate and EndDate. If
EndDate is null, it should read "Review Completed on: [BeginDate]. If not
null, it should read "Review Completed From [BeginDate] to [EndDate]. I
tried the IIf statement below, but it did not work.

=IIf([EndDate] Is Null,"(“Review Completed on: “ [BeginDate])",(“Review
Completed From “ & [BeginDate] & "to " & [EndDate]))

Thanks.


Just a helpful tip to help you get good responses when asking
questions in newsgroups.
Words like 'That didn't work' gives any potential reader who might
want to help you absolutely no useful information.
What didn't happen?
What did happen?
What did you expect to happen?
What is the exact code you wrote (copied directly from your database
and pasted here so we can see if you didn't simply mis-write the
code)?
Answers to those questions would be helpful to us .... to help you!

[BeginDate] and [EndDate] are Date/Time datatype fields?

Try this:
=IIf(IsNull([EndDate]),"Review Completed on: " & [BeginDate],"Review
Completed From " & [BeginDate] & " to " & [EndDate])


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail