Two Tables?

Hi Tony,

        You have 2 tables : CD and CDTracks - links=CDID fields.

        I suppose you are working with two windows : one with the CD Table and
another with the CDTracks Table.

        Each time you save the informations about the CDTracks(2 window), you
can save the CDID field of the CD Table (1 window) :

f.e. :
Form1 - Unit 1 :  

   Form1.edit1.text:=CDTable.fieldbyname('CDID').asstring;  
        // the CDID field of the CDTable appears in Edit1.

To open the Form2 : add a button in the Form1 'ADD TRACKS'.

Form2 - Unit 2 :
   CDTrackTable.edit;
   CDTrackTable.fieldbyname('CDID').asstring:=Form1.edit1.text;
   ...
   CDTrackTable.post;

If you don't want to use a edit1 in the Form1, you can write :

CDTrackTable.fieldbyname('CDID').asstring:=Form1.CDTable.fieldbyname('CDID').asstring;

So you can introduce many tracks in the TrackTable. Add a button in
Form2 to close it and to return to the Form1.

Don't forget to add :
  for Form1 : uses unit2;
  for Form2 : in the implementation : uses unit1;

I hope this would help you. Good Luck.

        Bye, Bye,

                Murielle.

Quote
Tony Dunn wrote:

> Hi All

> I'm building a CD collection app with a pair of tables in Delphi 1.0,
> and would appreciate some help when inserting a new record. The tables
> are CD and CDTracks, and have a common indexed field CDID which in the
> main CD table is auto-increment.

> What I want to do is create a new record that will make a new entry in
> the CD table, auto-increment the CDID field, but make a connection
> between the CDID field in both tables (adding the CDID number in the
> CDTracks table), and let me add many tracks in the CDTracks table,
> each of which links back to the CDID in the master table.

> This has to be easy, but I can't suss how :-( Replies to mail address
> preferred for speed...

> Tony <to...@mersinet.co.uk>