A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

2 salesmen for 1 project



 
 
Thread Tools Display Modes
  #1  
Old September 12th, 2007, 08:50 PM posted to microsoft.public.access.tablesdbdesign
Steve
external usenet poster
 
Posts: 2,662
Default 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  
Old September 12th, 2007, 09:28 PM posted to microsoft.public.access.tablesdbdesign
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default 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  
Old September 13th, 2007, 03:02 AM posted to microsoft.public.access.tablesdbdesign
Steve
external usenet poster
 
Posts: 2,662
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:05 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.