[RESOLVED] Whats the problem with this expression?
i am using VBnet 2002 and crystal v9.1
Please I am trying to define an expression in my crystal report but still having errors , Can you help me please???
below is my code,please advice accordingly ;
VB Code:
Local StringVar message := "";
Local Datevar confdate ={pensioners.date_conf_pens_terms};
Local Datevar hiredate ={pensioners.hiredate};
if hiredate = confdate then
message="N/A"
ELSE
confdate
I simply want to display a message "N/A" on the report when dates are equal and confdate when otherwise.
Please help.
Re: Whats the problem with this expression?
What are the error messages?
You need to use := when assigning values to variables.
Based on the IF statement the Formula returns either a string or a date. This is not allowed. A formula can only return 1 datatype.
Re: Whats the problem with this expression?
Thanks for the message.I have tried to make some changes to my code as you suggested but still am having an error message"The remaining text doesnt appear to be part of the formula" it highlights almost the whole code.below is the code
VB Code:
Local StringVar message := "";
Local Datevar confdate :=cstr{pensioners.date_conf_pens_terms};
Local Datevar hiredate :=cstr{pensioners.hiredate};
if hiredate = confdate then
message="N/A"
ELSE
confdate
Re: Whats the problem with this expression?
try
message := "N/A"
but do you even need the local variables
Code:
If {pensioners.hiredate} = {pensioners.date_conf_pens_terms} Then
"N/A"
Else
ToText({pensioners.date_conf_pens_terms})