Getting rid of "to" when the date fields are null

  • Thread starter Thread starter pschoen
  • Start date Start date
P

pschoen

I am using =[FromDate1] & " to " & [ToDate1] in the control source for a date
field of a report. When there are no dates entered, without this code, I end
up with "to". I have tried =[FromDate1] & " to " + [ToDate1] If the date
fields are null, it gets rid of the "to". If the date fields have data, I get
an error in the report.
 
Try this --
=IIF([FromDate1] Is Null OR [ToDate1] Is Null, Null, [FromDate1] & "
to " & [ToDate1])
 
Thanks Karl -- It worked to suppress the "to", but for some reason, now the
date wraps onto two lines in the report. I can't seem to get it to stay on
one line. The date field is horizontally aligned with another field. Could
that cause a problem?

I appreciate your help.

Phil Schoen

karl dewey said:
Try this --
=IIF([FromDate1] Is Null OR [ToDate1] Is Null, Null, [FromDate1] & "
to " & [ToDate1])
--
KARL DEWEY
Build a little - Test a little


pschoen said:
I am using =[FromDate1] & " to " & [ToDate1] in the control source for a date
field of a report. When there are no dates entered, without this code, I end
up with "to". I have tried =[FromDate1] & " to " + [ToDate1] If the date
fields are null, it gets rid of the "to". If the date fields have data, I get
an error in the report.
 
Just expand the text box horizontally.
--
KARL DEWEY
Build a little - Test a little


pschoen said:
Thanks Karl -- It worked to suppress the "to", but for some reason, now the
date wraps onto two lines in the report. I can't seem to get it to stay on
one line. The date field is horizontally aligned with another field. Could
that cause a problem?

I appreciate your help.

Phil Schoen

karl dewey said:
Try this --
=IIF([FromDate1] Is Null OR [ToDate1] Is Null, Null, [FromDate1] & "
to " & [ToDate1])
--
KARL DEWEY
Build a little - Test a little


pschoen said:
I am using =[FromDate1] & " to " & [ToDate1] in the control source for a date
field of a report. When there are no dates entered, without this code, I end
up with "to". I have tried =[FromDate1] & " to " + [ToDate1] If the date
fields are null, it gets rid of the "to". If the date fields have data, I get
an error in the report.
 
pschoen said:
I am using =[FromDate1] & " to " & [ToDate1] in the control source for a date
field of a report. When there are no dates entered, without this code, I end
up with "to". I have tried =[FromDate1] & " to " + [ToDate1] If the date
fields are null, it gets rid of the "to". If the date fields have data, I get
an error in the report.


You can get it by using:

=Mid((" to " + FromDate1) & (" to " + ToDate1), 5)
 
Back
Top