IIf

  • Thread starter Thread starter Laurie Meacham
  • Start date Start date
L

Laurie Meacham

I am creating a report that I want to spell out "has expired on" and the date
that I entered in the form if that date is prior to today; or to spell out
"will expire on" and the date that I entered in the form if that date is
greater than today. I used the following:
" Furthermore, the waiver of fees that you have received " &
IIf([Forms]![frm_rptDrugFeeLtr].[WvrExpDate]<='=GETDATE()',"has expired on
","will expire on ") & [Forms]![frm_rptDrugFeeLtr].[WvrExpDate] & ....

When I put the = in front of GETDATE, it will always print out 'will expire
on' no matter if date is before and after. If I take = out, it will always
print out 'has expired on' no matter if date is before or after.

What am I doing wrong?
 
" Furthermore, the waiver of fees that you have received " &
IIf([Forms]![frm_rptDrugFeeLtr].[WvrExpDate]<=GETDATE() ,"has expired on
","will expire on ") & [Forms]![frm_rptDrugFeeLtr].[WvrExpDate] & ....

Or Try

" Furthermore, the waiver of fees that you have received " &
IIf([Forms]![frm_rptDrugFeeLtr].[WvrExpDate]<=Date() ,"has expired on
","will expire on ") & [Forms]![frm_rptDrugFeeLtr].[WvrExpDate] & ....

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Thank you it worked using DATE(). When I used GETDATE() without the single
quotes it was telling me invalid column name.

John Spencer said:
" Furthermore, the waiver of fees that you have received " &
IIf([Forms]![frm_rptDrugFeeLtr].[WvrExpDate]<=GETDATE() ,"has expired on
","will expire on ") & [Forms]![frm_rptDrugFeeLtr].[WvrExpDate] & ....

Or Try

" Furthermore, the waiver of fees that you have received " &
IIf([Forms]![frm_rptDrugFeeLtr].[WvrExpDate]<=Date() ,"has expired on
","will expire on ") & [Forms]![frm_rptDrugFeeLtr].[WvrExpDate] & ....

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Laurie Meacham said:
I am creating a report that I want to spell out "has expired on" and the
date
that I entered in the form if that date is prior to today; or to spell out
"will expire on" and the date that I entered in the form if that date is
greater than today. I used the following:
" Furthermore, the waiver of fees that you have received " &
IIf([Forms]![frm_rptDrugFeeLtr].[WvrExpDate]<='=GETDATE()',"has expired on
","will expire on ") & [Forms]![frm_rptDrugFeeLtr].[WvrExpDate] & ....

When I put the = in front of GETDATE, it will always print out 'will
expire
on' no matter if date is before and after. If I take = out, it will always
print out 'has expired on' no matter if date is before or after.

What am I doing wrong?
 
Back
Top