Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Shared Variable Error Post Reply Post New Topic
Author Message
EddiRae
Newbie
Newbie


Joined: 29 Aug 2008
Online Status: Offline
Posts: 30
Quote EddiRae Replybullet Topic: Shared Variable Error
     Posted: 24 Jun 2009 at 8:18am
I have created several shared variables that I am using for a report.  One of the variables is giving me an error.  It is saying "A number is required here".
 
In the Group header, I have the variables initialized ...
WhilePrintingRecords;
numberVar RTTDYA := 0;
numberVar RTTDYK := 0;
numberVar RTTDYT := 0;
numberVar RTTDYH := 0;
In the Detail, I have the variables being calculated ....

WhilePrintingRecords;
numberVar RTTDYK;
RTTDYK := RTTDYK + {@TDYK};

This is the variable that I am having issues with.  They are ALL created exactly the same.  This is the only one that is giving me this error.
 
I am not sure what to check for.
 
Any help would be greatly appreciated.
Eddi Rae


Edited by EddiRae - 24 Jun 2009 at 8:18am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 24 Jun 2009 at 11:28am
I would suspect that {@TDYK} is not a number.  Just for fun try:
RTTDYK := RTTDYK + VAL({@TDYK});
 
if that works, then it is the field that is being passed as something that is not a number.
 
HTH
IP IP Logged
EddiRae
Newbie
Newbie


Joined: 29 Aug 2008
Online Status: Offline
Posts: 30
Quote EddiRae Replybullet Posted: 24 Jun 2009 at 11:41am
I tried your suggestion.  That gave me the message:  A string is required and placed the cursor in front of the {@TDYK}.
 
When I was getting the error A number is required, it was placing the cursor in front of the RTTDYK that is behind the :=.
 
It has to be something simple and I am not seeing it.  It always works that way.
 
Thanks!!
Eddi Rae
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 24 Jun 2009 at 11:48am
I would try searching for the variable name....could it be defined as a string somewhere else....since it is shared, it could be anywhere in the report or subreport(if you are using one). That is at least my first thought.  The other...just to get past this would be to declare a local (or a new shared) numbervar and see if adding to that throws the same error.
IP IP Logged
EddiRae
Newbie
Newbie


Joined: 29 Aug 2008
Online Status: Offline
Posts: 30
Quote EddiRae Replybullet Posted: 24 Jun 2009 at 12:31pm
I created a new variable and it gave me the same error.  I then tried changing out the @TDYK to be another variable that is working properly.  That corrected it!!! 
 
 
I see what it is!!!   the field in the Access database is defined as currency!!!  All the other fields that I am using are defined as a number.  Once I changed that field to be a double (cdbl({STATS.K})) the field worked correctly!!
 
This was driving me crazy!!
 
Thanks, again for all your help!!
Eddi Rae
IP IP Logged
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