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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|