Many to One Population (1 Viewer)

cambarn80

New member
Local time
Today, 04:14
Joined
Jun 20, 2023
Messages
1
Hello, I am currently at a dead end and I am not sure where I went wrong. I have a form and I am being asked to make the attorney name populate their respective firms. I have a table of the attorney names and their corresponding firm ids along with a table with just the firm names. I have a combo box set up for the attorney names in the form but I cant figure out the rest. Any help would be appreciated.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 09:14
Joined
Feb 19, 2013
Messages
16,612
If you need help - start with showing your table design and relationships
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:14
Joined
Oct 29, 2018
Messages
21,473
Hi. Welcome to AWF!

You might be able to accomplish this by using a Combobox on your form.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:14
Joined
Feb 28, 2001
Messages
27,186
What you need to know in this situation:

You have a PARENT form (the list of firms) and a CHILD form (the list of attorneys who work for those firms). A formal relationship can be built if you have a firm ID that acts as the primary key of the list of firms, and you need a corresponding field for the firm ID in the list of attorneys. It is not good practice to use the same names in two different fields when forming a relationship, so the firm list might have a field called FirmID and the attorneys would have a field called FirmFK (FK = foreign key). A foreign key is NOT a primary key though it COULD (if you wished) have a non-unique index. You cannot build a formal relationship if the parent field isn't a unique key (which a primary key IS).

If you wanted to see everything aligned once you fill in the appropriate FirmID values to the FirmFK field, you MIGHT create a query looking something like this:

Code:
SELECT F.FirmName, A.AttorneyName FROM Firm AS F INNER JOIN Attorney AS A ON F.FirmID = A.FirmFK GROUP BY F.FirmName ORDER BY FirmName, AttorneyName ;

Obviously it would take more than this to fill in all the info you might want, but this gives you a basic idea of how such a thing would work. The ... INNER JOIN ... ON sequence shows the columns, one from each table, that are related to each other.
 

Users who are viewing this thread

Top Bottom