----- Original Message -----
Sent: Tuesday, May 01, 2001 8:21
PM
Subject: RE: [DUG]: Passing
DataSet to Quick Report
Possibly an answer to two question in
one:
First, I assume you shouldnt pass the
Dataset name, pass the Dataset object (TDataset) - which is just a
pointer anyway.
Regarding the variables thing the ideal is to
write code that is self documenting and as self contained as possible.
A procedure that depends on a global variable to operate correctly
requires someone to explain that fact, and is less portable (what say
that global variable has a different name in another program?). That
said, class methods often rely on form level variables - but they are
always part of the class that has these variables so, again, things
are self contained.
Avoid using global variables, but not too an
extreme. Often you'll want to, say, remember the state of a grid
(edited/ not edited) and a procedure will need to chck out this global
variable to, say, disable/enable buttons ... thats fair enough. But
make sure its easy to follow - the variables are clearly named etc.
[James Low] -----Original
Message-----
From: Mark Howard
[mailto:[EMAIL PROTECTED]]
Sent: 3 May 2001
09:51
To: Multiple recipients of list
delphi
Subject: [DUG]: Passing DataSet to Quick
Report
Hi All
I would like to pass a Dataset name to
a Quick Report but am not sure how to go about
this.
I have something like:
with QueryDataModule.Query1 do
begin
Close;
DatabaseName :=
MainForm.DatabaseName;
SQL.Clear;
SQL.Add('Select stuff
from Tables);
Open;
end;
Application.CreateForm(TBCInv,
BCInv);
if OutMode = 'Screen' then
BCInv.Report.Preview
else BCInv.Report.Print;
What I want to do is pass
QueryDataModule.Query1 to BCInv on this occaision
and some other dataset to it on another
occaision.
Has anyone some code snippets that
demonstrate this?
TIA
Mark