|
-
Dec 25th, 2004, 02:20 PM
#1
Thread Starter
PowerPoster
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
-
Dec 25th, 2004, 02:23 PM
#2
Banned
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?
-
Dec 25th, 2004, 02:29 PM
#3
Thread Starter
PowerPoster
Re: Crystal Reports Formula problem
It's the very beginning of the statement....the cursor sets right in front of the IF.
-
Dec 25th, 2004, 02:31 PM
#4
Thread Starter
PowerPoster
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!
-
Dec 25th, 2004, 02:34 PM
#5
Banned
Re: Crystal Reports Formula problem
is it just me or dont i see anything in this code
-
Dec 25th, 2004, 02:35 PM
#6
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 25th, 2004, 02:37 PM
#7
Thread Starter
PowerPoster
Re: Crystal Reports Formula problem
That didn't work Rob....still gives me the same error msg...
-
Dec 25th, 2004, 02:41 PM
#8
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
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 25th, 2004, 02:43 PM
#9
Thread Starter
PowerPoster
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
-
Dec 25th, 2004, 02:44 PM
#10
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.
-
Dec 25th, 2004, 02:48 PM
#11
Thread Starter
PowerPoster
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"
-
Dec 25th, 2004, 02:49 PM
#12
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 25th, 2004, 02:51 PM
#13
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 25th, 2004, 02:53 PM
#14
Thread Starter
PowerPoster
Re: Crystal Reports Formula problem
Rob,
the formula is not being suppressed!
-
Dec 25th, 2004, 02:58 PM
#15
Re: Crystal Reports Formula problem
Hmm..., how about placing the code in a Formula Field. Then bind that
formula field to your address textbox?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|