Board index » delphi » Query duplication within a child form

Query duplication within a child form

Hi,

I have an application that I want to be able to spawn child windows
based upon the row I select from a dbgrid
This works fine for the first row I select.  When I select a second row,
an new form appears (again correct)
with the new data set based upon my newly selected row from my parent
form.
But what happens is my original child form changes to the results of the
new query.
They are joined (the two child windows)  and I do not understand what I
doing wrong.
I want to be able to have as many child windows on the screen as needed,
all displaying different information.

I am using d5 with Oracle 8i and the odac components from CoreLab

thx,
wes

 

Re:Query duplication within a child form


Looks like all your child forms are connected to the same query (or master
query). So when a second child form appears, it scrolls the dataset of the
parent form, which is reflected in the first child form.

--

Alain Quesnel
cinqsanss...@compuserve.com

------

Quote
"Wes Baird" <w...@datamatters.com> wrote in message

news:3B96E161.9BAE96BB@datamatters.com...
Quote
> Hi,

> I have an application that I want to be able to spawn child windows
> based upon the row I select from a dbgrid
> This works fine for the first row I select.  When I select a second row,
> an new form appears (again correct)
> with the new data set based upon my newly selected row from my parent
> form.
> But what happens is my original child form changes to the results of the
> new query.
> They are joined (the two child windows)  and I do not understand what I
> doing wrong.
> I want to be able to have as many child windows on the screen as needed,
> all displaying different information.

> I am using d5 with Oracle 8i and the odac components from CoreLab

> thx,
> wes

Re:Query duplication within a child form


You are right.  They all are connect to the same query.
So then I would dynamically create a new query for each new form?
Do you have an example of how to do this?

thx,
wes

Quote
Alain Quesnel wrote:
> Looks like all your child forms are connected to the same query (or master
> query). So when a second child form appears, it scrolls the dataset of the
> parent form, which is reflected in the first child form.

> --

> Alain Quesnel
> cinqsanss...@compuserve.com

> ------
> "Wes Baird" <w...@datamatters.com> wrote in message
> news:3B96E161.9BAE96BB@datamatters.com...
> > Hi,

> > I have an application that I want to be able to spawn child windows
> > based upon the row I select from a dbgrid
> > This works fine for the first row I select.  When I select a second row,
> > an new form appears (again correct)
> > with the new data set based upon my newly selected row from my parent
> > form.
> > But what happens is my original child form changes to the results of the
> > new query.
> > They are joined (the two child windows)  and I do not understand what I
> > doing wrong.
> > I want to be able to have as many child windows on the screen as needed,
> > all displaying different information.

> > I am using d5 with Oracle 8i and the odac components from CoreLab

> > thx,
> > wes

Re:Query duplication within a child form


Wes,

   Drop a TQuery onto your child form(s) and

Application.CreateForm(TChildForm, ChildForm);
   try
       ChildForm.qDetail.DatabaseName := Database1.DatabaseName; {use your
current connection}
       ChildForm.qDetail.SQL.Text := qMaster.SQL.Text;
       {open the query here or in the child form's onshow event...}
      ChildForm.ShowModal;
   finally
      ChildForm.Release;
   end;

Good luck,
krf

Quote
Wes Baird <w...@datamatters.com> wrote in message

news:3B976EA4.D4CE000@datamatters.com...
Quote
> You are right.  They all are connect to the same query.
> So then I would dynamically create a new query for each new form?
> Do you have an example of how to do this?

> thx,
> wes

Other Threads