IIf

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?
 
J

John Spencer

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

Laurie Meacham

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top