If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
2 salesmen for 1 project
I have 2 tables set up, tblProjects and tblSalesmen.
Each project will have 2 (and only 2) salesmen. On frmProjects, I have 2 comboboxes, Salesman1 and Salesman2. The comboboxes have 2 columns, but I set the width = 0 for the first column. The first column is bound, so I am storing the primary key of each in tblProjects. I want to create a query that shows the ProjectName, first name of Salesman1, and first name of Salesman2. I can only get my query to show the primary key of the salesmen, and not the first name. How do I do this? thanks, Steve Thanks, Steve |
#2
|
|||
|
|||
2 salesmen for 1 project
Add the tblSalesmen table to your query twice and left join from tblProjects.
The join is from Salesman1 field to primary key of tblSalesmen and from Salesman2 field to primary key of tblSalesmen_1 (Access add a suffix when you have the table twice). Then use FirstName from each of the tblSalesmen and label Salesman_1 and Salesman_2. -- KARL DEWEY Build a little - Test a little "steve" wrote: I have 2 tables set up, tblProjects and tblSalesmen. Each project will have 2 (and only 2) salesmen. On frmProjects, I have 2 comboboxes, Salesman1 and Salesman2. The comboboxes have 2 columns, but I set the width = 0 for the first column. The first column is bound, so I am storing the primary key of each in tblProjects. I want to create a query that shows the ProjectName, first name of Salesman1, and first name of Salesman2. I can only get my query to show the primary key of the salesmen, and not the first name. How do I do this? thanks, Steve Thanks, Steve |
#3
|
|||
|
|||
2 salesmen for 1 project
Karl,
THANK YOU! This was driving me crazy, but you explained everything perfectly. When you say "label" are you referring to the alias? Are there any pitfalls of using this function? Thanks again, Steve "KARL DEWEY" wrote: Add the tblSalesmen table to your query twice and left join from tblProjects. The join is from Salesman1 field to primary key of tblSalesmen and from Salesman2 field to primary key of tblSalesmen_1 (Access add a suffix when you have the table twice). Then use FirstName from each of the tblSalesmen and label Salesman_1 and Salesman_2. -- KARL DEWEY Build a little - Test a little "steve" wrote: I have 2 tables set up, tblProjects and tblSalesmen. Each project will have 2 (and only 2) salesmen. On frmProjects, I have 2 comboboxes, Salesman1 and Salesman2. The comboboxes have 2 columns, but I set the width = 0 for the first column. The first column is bound, so I am storing the primary key of each in tblProjects. I want to create a query that shows the ProjectName, first name of Salesman1, and first name of Salesman2. I can only get my query to show the primary key of the salesmen, and not the first name. How do I do this? thanks, Steve Thanks, Steve |
Thread Tools | |
Display Modes | |
|
|