Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: FormulaFields VS2003/VS2005 Post Reply Post New Topic
Author Message
Dave
Newbie
Newbie


Joined: 01 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 10
Quote Dave Replybullet Topic: FormulaFields VS2003/VS2005
    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
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
Dave
Newbie
Newbie


Joined: 01 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 10
Quote Dave Replybullet 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
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
Dave
Newbie
Newbie


Joined: 01 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 10
Quote Dave Replybullet 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
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.