Print Page | Close Window

FormulaFields VS2003/VS2005

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1197
Printed Date: 04 May 2024 at 1:28am


Topic: FormulaFields VS2003/VS2005
Posted By: Dave
Subject: FormulaFields VS2003/VS2005
Date Posted: 19 Aug 2007 at 3:09pm
Hi

I had a project that worked fine in VS2003 for 2 years. However when I migrated it to VS 2005 it gave an error/stopped working
It uses the technique described on pages 317/318.

I had a line
companyname = Chr(34) & licenced.licenceduser & Chr(34)

then

thereport.DataDefinition.FormulaFields("CoName").Text = companyname

above worked fine in VS2003 but gives an "Error in Formula <CoName> when used with VS 2005

When I used
companyname = Chr(39) & licenced.licenceduser & Chr(39)

The error was no longer present but the data in CoName was not printed on the report.

I have been at this for ages and cannot see what's wrong.

Something has changed from VS2003 to VS2005

Anyone have any ideas what?

Dave





-------------
Dave



Replies:
Posted By: BrianBischof
Date Posted: 20 Aug 2007 at 11:26pm
I don't see why 34 would give an error but not 39. Is there any chance that your data has an apostrophe in it and this messes up the formula assignment?



-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: Dave
Date Posted: 21 Aug 2007 at 2:27pm

Hi

Simplified my code to eliminate any spurious characters such as apostrophes.
 
Dim temp As String
temp = "Fred"
companyname = Chr(34) & temp & Chr(34)
thereport.DataDefinition.FormulaFields("CoName").Text = companyname
 
I still get the same error message.
 
What puzzles me is that it all work perfectly in VS2003 all I did was run the upgrade wizard and this happens.
 
regards
 
 
Dave
 
 


-------------
Dave


Posted By: BrianBischof
Date Posted: 21 Aug 2007 at 2:56pm
I wonder if the upgrade wizard corrupted it? What about creating a new and simplistic report striclty in VS 2005 and use the filter there?

Oh yeah - go into your report and set the record selection formula manually and see if it gives you the error or not. I always do that first whenever I run into problems with assigning it in .NET. You gotta get the formula working in CR before using the object model, and CR might give you a better error message when doing it this way.


-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: Dave
Date Posted: 11 Nov 2007 at 12:01pm

Cracked it!  Took your advice and tried a simple report it worked.

I then looked closely at the reports that did not work.  Guess what? They had been set to Basic Syntax by mistake. Put them back to Crystal syntax and they worked.
 
What I don't understand is why they ever worked in VS 2003.
As they worked in VS 2003 and not work in VS 2005 I assumed it was a VS 2003 -> VS 2005 issue.
 
Dave


-------------
Dave



Print Page | Close Window