4 Replies Latest reply on Nov 25, 2009 8:05 AM by Coolguy

    Foreign key issue..

    Coolguy

      Title

      Foreign key issue..

      Post

      I have two table one is Client information which contain ClinetID(primar key , genrated automatically),Name ,Adress,Mobile no

      another table is Car Info which contain Client ID(primary key) ,Brand,Year,Service day,Time .

         I would like to  entry data from Single layout( need to enter client data & car info in single window).How can i peroform that.

      Already created a calender and also created all time slot for Carinfo table(that means empty records are existing for car info which contains day & time for an year).Using realtion ship & "allow creation of record by using this realtion ship" will create a new reocrd. I dodnt want like this i need to like update the raw record . How can i perform that.

       

      Please help me.

       

      thanks in advance

        • 1. Re: Foreign key issue..
          ninja
            

          Howdy Coolguy,

           

          If I understand correctly, you have three tables (you said you have two):

          Client info

          Car Info

          Join Table for which Client has which Car

           

          ...and you want to enter client info and car info from the same layout

           

          Dangerous, but certainly possible.

          Put the Car info fields on the Client layout.  You will only be able to edit the car which is joined to that client, but that may be OK...your call.  You can also do finds based on the "Car" fields to update other car records.

           

          It would be better (in my opinion) to have a car layout based on the Car table and update your car data from there.

           

          Note: If I misunderstand your structure, my guidance may also be inappropriate.

          If I misunderstand or assume incorrectly, please correct ...

          • 2. Re: Foreign key issue..
            Coolguy
              

            If i put car field in client layout i cant insert  value if i am entring a new client because no Client ID(foreign key is not exiting) in car table so that car field will not be active.

             

            • 3. Re: Foreign key issue..
              ninja
                

              Coolguy wrote:

              If i put car field in client layout i cant insert  value if i am entring a new client because no Client ID(foreign key is not exiting) in car table so that car field will not be active.

               


               

              Which tends to confirm that you have three tables...two main tables and a join.  You can make a new record in the join table from Client Table, but the second ID# relating to Car is not there.

               

              You could make a second table occurrence of "Car" and relate it to Client so you could do data entry, but this would open up a high probability that you will get duplicate records in the Car Table.

               

              Perhaps it makes sense to use two layouts...?

              If you want them to look the same, and switch between the two layouts via a button, this would maintain your appearance of a single layout.  When a "Car" field is clicked on the "Client" layout, it could perform a GoToLayout [Car].  The screen would not appear to change, but the table on which the layout is based would change to the Car Table.

              If this is really the direction you want to go...put a big transparent button over the "car" section of the layout so that any click in that area would go to the "Car" layout.  (Vice versa for going back to the "Client" layout.

               

              Or simply use two layouts, one for Client, one for car...but that's not what you said you want.


              • 4. Re: Foreign key issue..
                Coolguy
                  

                Ninja thank you very for your advice...

                Transparent button is rocking :)