Results 1 to 9 of 9

Thread: Form when PK two tables populate a third, How do ?

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Question Form when PK two tables populate a third, How do ?

    Hi


    What is the best way to make a form that has 3 tables (A,B,C)

    Since two tables (A,B) populate their Pk for a third (C)

    Could someone give an idea of the best way to do this on a screen


    Tia

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Form when PK two tables populate a third, How do ?

    Not enough info. There are several ways to structure a form with one or more sets of data. Would need much more specific info to give any real help here.

    Currently I am working on a project that uses 3 tables and displays them on one form. Lets call one table the parent and the other two children.
    Both of the child tables contain the PK from the parent table

    My form has some text fields at the top which hold the data from the parent table.
    Below that is a small flexgrid which holds data from the first child some of which is hidden from view.
    Below that is another small flexgrid which holds data from the other child some of which is also hidden from view.

    The stuff that is hidden from view are things like the RecordID number and the ParentID number for example.

    I do not know if this will help you any or not.

    btw There is no data binding in use, all fields and grids are populated via code. All additions, edits and deletions are also done through code.

  3. #3

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Re: Form when PK two tables populate a third, How do ?

    Thank you

    But would like something like

    Name:  pkfk.jpg
Views: 127
Size:  3.7 KB

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Form when PK two tables populate a third, How do ?

    Can't say as I have no idea what kind of data may be in the tables, how you need to display it nor what you want to do with it.

    What you posted looks like just two list boxes with arrows to move items from one to the other. That is pretty far from looking like three tables.

    Again you need to give some specifics if you would like some guidance.

  5. #5

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Re: Form when PK two tables populate a third, How do ?

    I must to save in table C the pk From tables A and B


    Name:  PK_FK.jpg
Views: 124
Size:  8.8 KB

    tia

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Form when PK two tables populate a third, How do ?

    Still no specifics. No idea what or how many fields you are talking about or how the tables related to one another. All you mention is PK and tables A,B and C. How can anyone possibly give you advice on how to create the form without any information about the data which needs to be displayed and/or manipulated on it.

  7. #7
    Frenzied Member
    Join Date
    Jun 2014
    Posts
    1,084

    Re: Form when PK two tables populate a third, How do ?

    as DataMiser says...
    however who knows ? maybe :

    a grid with all the records from table A on the left
    a grid with all the records from table B on the right

    a grid in the middle a bit below the headings of A and B
    to show the result of the many to many relationship between A and B (table C)

    a commandbutton to put the PK 's from A and B in C
    the PK of C has to be the combination of the PK's from A and B that are put in C

    to actually put a PK of A and a PK of B in C
    the user has to select a record from A and a record from B, and click the commandbutton
    your code then has to put the PK's of A and B in C
    and show the result in the grid of table C

    seems simple to me, and very intuitive to the user

    be sure if the user choices a combination of PK's of A and B that already exists
    to politely inform the user that combination already exists
    and nice would be to highlight that combination in C

    but of cource, if there is not a many to many relationship between A and B
    my suggestion will give totally unwanted results
    do not put off till tomorrow what you can put off forever

  8. #8
    Hyperactive Member
    Join Date
    Oct 2016
    Posts
    369

    Re: Form when PK two tables populate a third, How do ?

    What is PK

  9. #9
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,272

    Re: Form when PK two tables populate a third, How do ?

    Quote Originally Posted by I Love VB6 View Post
    What is PK
    Primary Key (of a database table)
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width