Board index » delphi » Using TTable on multiple forms

Using TTable on multiple forms

I realize that this has been covered several times in the past, but I  
have managed to loose the hardcopy printouts that I made of the previous
responses.

I have a project using Delphi 1 which displays the records in a database
(dBase) in a TBDgrid.  I wish to be able to select a record on the grid
and have another form displayed with the fields layed out in "form"
manner populated with the data for the selected record.  I know that this
will require using the same TTable for both forms so that they can both
have visibility to the same record pointer/number.  

Any assistance will be greatly appreciated.   Thank you!!

 

Re:Using TTable on multiple forms


"Michael E. Kirst" <mki...@apache1.orl.mmc.com> wrote:

Quote
>I realize that this has been covered several times in the past, but I  
>have managed to loose the hardcopy printouts that I made of the previous
>responses.
>I have a project using Delphi 1 which displays the records in a database
>(dBase) in a TBDgrid.  I wish to be able to select a record on the grid
>and have another form displayed with the fields layed out in "form"
>manner populated with the data for the selected record.  I know that this
>will require using the same TTable for both forms so that they can both
>have visibility to the same record pointer/number.  
>Any assistance will be greatly appreciated.   Thank you!!

1.
Insert the name of the form with the grid in the "uses"-part of the
form with the DBEdits.
If this is recursive, insert a "uses" behind the "implemantation" of
the form.

2.
Connect every DataSource-Property of the DBEdits with the DataSource
on the form with the grid. You must do that during runtime for example
in the "FormCreate"-Event.

...probally more confusing then helpful!?!?!?

Norbert Froehlich

Re:Using TTable on multiple forms


On Thu, 25 Jul 1996 14:49:21 -0400,
Michael E. Kirst  <mki...@apache1.orl.mmc.com> wrote:

Quote
>I have a project using Delphi 1 which displays the records in a database
>(dBase) in a TBDgrid.  I wish to be able to select a record on the grid
>and have another form displayed with the fields layed out in "form"
>manner populated with the data for the selected record.  I know that this
>will require using the same TTable for both forms so that they can both
>have visibility to the same record pointer/number.  

In Form1, drop a TTable, a TDataSource and a TDBGrid, and wire them
accordingly.  In Form2, where you have your _data_entry_form_, drop a
TDataSource component (Do not drop a TTable).  Then add thisline in the
OnCreate event handler:

  DataSource1.DataSet := Form1.Table1;

Make sure that Unit2 is referenced in the Uses clause of Unit1, and Unit1 is
referenced in the Uses clause of Unit2.  Both Uses clauses _MUST_ be in the
Implementation (not Interface) section.

Lito Dizon
adi...@us.net

Other Threads