Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,
I'm getting LastActivityDate column from the stored procedure.
when i bind that column in SSRS report it gives error, if the column has no or null value.

I tried with following
=iif((Fields!LastActivityDate.Value = ""),"",format(cdate(Fields!LastActivityDate.Value),"dd-MM-yyyy"))


but it still not working, give #error when report is run for null values.

Any idea where I'm going wrong..?

Thanks in advance =)
Posted
Updated 7-Mar-17 0:38am

change to:
=iif((Fields!LastActivityDate.Value = Nothing),"",format(cdate(Fields!LastActivityDate.Value),"dd-MM-yyyy"))
 
Share this answer
 
Comments
dhage.prashant01 27-Aug-12 6:56am    
Still its giving the same error.. :(
Kuthuparakkal 27-Aug-12 7:02am    
Make sure LastActivityDate conforms VBA datestring format:
Conversion Result
---------- ------
CDate("May 14 1977") 14/05/1977

CDate("14/May/1977") 14/05/1977

CDate("14/05/1977") 14/05/1977

CDate("05/14/1977") 14/05/1977

CDate(0) 12:00:00 AM

CDate(-1) 29/12/1899
dhage.prashant01 28-Aug-12 2:09am    
i have handled the same in backend, its working fine.
Try:
VB
=iif((Fields!LastActivityDate.Value Is Nothing),"No-Date", FORMAT(CDate(Fields!LastActivityDate.Value),"dd-MM-yyyy"))
 
Share this answer
 
Comments
dhage.prashant01 27-Aug-12 7:23am    
Still same issue
if i replace some other date field in
FORMAT(CDate(Fields!LastActivityDate.Value),"dd-MM-yyyy")

It works fine, but referring same field gives error.

Any idea, y so??
Sandeep Mewara 27-Aug-12 7:49am    
Might be your 'this' date field is not null. Check the query what is being returned for the field.
dhage.prashant01 28-Aug-12 2:09am    
i have handled the same in backend, its working fine.
I have handled in query part of dataset itself and then binding it to report
 
Share this answer
 
v2
=FORMAT(CDate(IIf(CSTR(Fields!EMP_REVISED_END_DATE.Value)="","1900-01-01",Fields!EMP_REVISED_END_DATE.Value)),"dd-MMM-yyyy"))
 
Share this answer
 
Comments
Richard Deeming 27-Sep-16 15:14pm    
Four years and one month late to the party, and your "solution" doesn't even match the question!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900