Crystal Reports Formula problem
I am trying to use crystal reports 8.5. I have created a formula that is not working. It's very simple yet, I still can't get it to work. Below is what the formula looks like:
VB Code:
If IsNull({tblClientAddr.addAddr2}) Then
{tblClientAddr.addAddr1}
Else
Trim({tblClientAddr.addAddr1}) & ", " & Trim({tblClientAddr.addAddr2})
I keep getting the error message:
"The result of the selection formula must be a boolean"
I also stuck the End If statement in at the end but it still gives me that message. What am I doing wrong?
thanks,
Blake
Re: Crystal Reports Formula problem
i think there is a special forum for this... anyway can you post the line of code that it is high lighting?
Re: Crystal Reports Formula problem
It's the very beginning of the statement....the cursor sets right in front of the IF.
Re: Crystal Reports Formula problem
Ok,
Now if I insert the End If at the end of the If statement....I get the following error msg:
VB Code:
If IsNull({tblClientAddr.addAddr2}) Then
{tblClientAddr.addAddr1}
Else
Trim({tblClientAddr.addAddr1}) & ", " & Trim({tblClientAddr.addAddr2})
End If
"The remaining text does not appear to be part of the formula" and the cursor sets at the end of the else branch.
Hope that helps!
Re: Crystal Reports Formula problem
is it just me or dont i see anything in this code
Re: Crystal Reports Formula problem
I think it needs to be like this.
VB Code:
If IsNull({tblClientAddr.addAddr2}) = True Then
{tblClientAddr.addAddr1}
Else
Trim({tblClientAddr.addAddr1}) & ", " & Trim({tblClientAddr.addAddr2})
Edit: Its been a while since I used CR, but I also think that maybe it needs to actually return a True or False.
Re: Crystal Reports Formula problem
That didn't work Rob....still gives me the same error msg...
Re: Crystal Reports Formula problem
I think I know what your trying to do. You need two textbox controls. One
bound with just field1 and the other bound with field1 and 2. Then in the
formatting properties of the two textboxes, add this formula to each. It will
test for field 2 to be null. If it is it sets the visibility to true or false.
Toggeling each textbox.
VB Code:
If IsNull({tblClientAddr.addAddr2}) = True Then
True
Else
False
Then in the other textbox, use this.
VB Code:
If IsNull({tblClientAddr.addAddr2}) = True Then
False
Else
True
Re: Crystal Reports Formula problem
Rob,
Actually, I have had this formula working in the past and for some reason it's not working now. Anyway, I will try a few more things....
Thanks
Re: Crystal Reports Formula problem
Take out the if/else/end, and try the first statement. It doesn't look like it is doing anything. Whatever you are trying to do doesn't look right. The else clause just concatenates it.
Re: Crystal Reports Formula problem
I tried using this:
VB Code:
{tblClientAddr.addAddr1} & ", " & {tblClientAddr.addAddr2}
and it still gave me the msg:
"The result of the selection formula must be a boolean"
Re: Crystal Reports Formula problem
David, he is trying to show only the addres that is populated in the db. If the
address has only one field the show just that. If the address has two fields
then show both.
Re: Crystal Reports Formula problem
Also, where is this formula under, Suppress? If so Suppress need to return a
True or a False so it knows how to show the control.
Re: Crystal Reports Formula problem
Rob,
the formula is not being suppressed!
Re: Crystal Reports Formula problem
Hmm..., how about placing the code in a Formula Field. Then bind that
formula field to your address textbox?