A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

IIf statement



 
 
Thread Tools Display Modes
  #1  
Old August 11th, 2009, 04:18 PM posted to microsoft.public.access.reports
jmoore[_2_]
external usenet poster
 
Posts: 81
Default IIf statement

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.
  #2  
Old August 11th, 2009, 05:27 PM posted to microsoft.public.access.reports
John Spencer
external usenet poster
 
Posts: 7,815
Default IIf statement

Probably the following should be your expression.

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

If this does not work as you expect, post back and tell us what the problem
is. "Does not work" is not a good description of the problem.

Do you get an error message, the wrong thing displayed, nothing displayed, or
does something else happen?

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

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.

  #3  
Old August 11th, 2009, 05:28 PM posted to microsoft.public.access.reports
fredg
external usenet poster
 
Posts: 4,386
Default IIf statement

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
  #4  
Old August 11th, 2009, 05:35 PM posted to microsoft.public.access.reports
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default IIf statement

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

--
Build a little, test a little.


"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.

  #5  
Old August 19th, 2009, 03:18 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.

"John Spencer" wrote:

Probably the following should be your expression.

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

If this does not work as you expect, post back and tell us what the problem
is. "Does not work" is not a good description of the problem.

Do you get an error message, the wrong thing displayed, nothing displayed, or
does something else happen?

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

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.


  #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

  #7  
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.

"KARL DEWEY" wrote:

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

--
Build a little, test a little.


"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.

  #8  
Old August 19th, 2009, 03:33 PM posted to microsoft.public.access.reports
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default IIf statement

Increase the horizontal width of the display box.
--
Build a little, test a little.


"jmoore" wrote:

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.

"KARL DEWEY" wrote:

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

--
Build a little, test a little.


"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.

  #9  
Old August 19th, 2009, 04:09 PM posted to microsoft.public.access.reports
jmoore[_2_]
external usenet poster
 
Posts: 81
Default IIf statement

I can't believe it was so simple. I'm sure I tried to increase the text box
at one time and it did not work. I have the Can Grow set to Yes. Why didn't
that allow the text box to expand when needed?

"KARL DEWEY" wrote:

Increase the horizontal width of the display box.
--
Build a little, test a little.


"jmoore" wrote:

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.

"KARL DEWEY" wrote:

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

--
Build a little, test a little.


"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.

  #10  
Old August 19th, 2009, 04:15 PM posted to microsoft.public.access.reports
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default IIf statement

I do believe that Can Grow only works vertically.
--
Build a little, test a little.


"jmoore" wrote:

I can't believe it was so simple. I'm sure I tried to increase the text box
at one time and it did not work. I have the Can Grow set to Yes. Why didn't
that allow the text box to expand when needed?

"KARL DEWEY" wrote:

Increase the horizontal width of the display box.
--
Build a little, test a little.


"jmoore" wrote:

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.

"KARL DEWEY" wrote:

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

--
Build a little, test a little.


"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.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.