If you want to recreate the exact Private DS Tables, relationships, etc. for the sake of the report you may need to do it all in Session Code;
Define Class MyreportDS As Session
Proc Init()
Open abc IN 0 Shared
Open def in 0 Shared
Set Relation to CustNo into abc
etc. etc...
.....
Report Form Blah-Blah Preview
EndProc
Proc Destroy()
Close All
EndProc
EndDefine
This DS can be attached to an Object via ADDObject method (I haven't tested it 'on the fly' at runtime but have successfully Subclassed it ahead of time):
CmdButton.Init()
THIS.AddObject("LocalDS","MyreportDS")
The Session is completely unaware of the Form's Tables and relationships, etc..
HTH,
-Irv.
>Sorry, I wasn't clear.
>I have a form already with it's own private data session.
>I want to have a button on the form create another private data session, run a report from the new data session, then close the new data session.
>
>I'm trying to duplicate the report's private data session, but I need to maninupulate the view the report uses, and I don't want it cluttering up the form's data session.
>
>
>>Set the Form's DataSession property to 2 - Private Data Session.
>>
>>>I want to create a private datasession and print a report from it.
>>>
>>>The user would select different parameters on a form, then click a button and the report would print from a private data session (and release itself when done).
>>>
>>>In a prg I "DEFINE CLASS DS as SESSION", and it works from the command window, but I can't get it to work in a form.