Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shared Variables problem in Crystal 7

Status
Not open for further replies.

ledgerama

Programmer
Jan 27, 2004
3
NZ
Hi there,

I am trying to get a value back from a sub report to the main report, but everytime i set the scope of the required variable to Shared the value of the variable resets to 0.

The formula is as follows...
Code:
BooleanVar doit;
NumberVar OPTinSec;

If ({ERA_MSCH_ACTIVITIES.ERA_ACTIVITY_TYPE} = 2) Then 
    (
    OPTinSec := OPTinSec - DateTimeToSeconds ({ERA_MSCH_ACTIVITIES.ERA_START_TIME});
    doit := true;    
    )
Else 
If (doit = true) Then
    (
    OPTinSec := OPTinSec + DateTimeToSeconds ({ERA_MSCH_ACTIVITIES.ERA_START_TIME});
    doit := false;
    )
Else 
    (
    doit := false;
    );

OPTinSec

if i run the report with this formula the OPTinSec value is correct. As soon as I change the second line to

Code:
Shared NumberVar OPTinSec;

it always gives a value of 0. Any ideas why it would be doing this?
 
How do you receive this variable in the main report? With formula? Shared variable has to be declared as such everywhere it is used.
 
doesn't matter, i seemed to figure it out then it ecame irrelavant as the sub report uses the same database with a different login and there seems to be no way of giving two different logins for one datasource in info desktop.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top