I use this query to populate a combo box. tblPersonnel has a many-to-one relationship with tblOffices (a lot of people can work at one office). However, some people have two or more offices they work at. To indicate this, I currently display both the personnel name and the office name. I would like to do away with the office name and replace it with an instance count value. Any suggestions on a resolution to this problem will be appreciated.
For instance:
tblOffices.ID PersonName OfficeName
289 Bob Smith Milwaukee
323 Bob Smith Bob Smith Home
Could I replace the Officename with a 1, a 2, etc.
SELECT tblOffices.ID, [First] & ' ' & [Last] AS PersonName, tblOffices.OfficeName
FROM tblOffices INNER JOIN tblPersonnel ON tblOffices.ID = tblPersonnel.OfficeID
GROUP BY tblOffices.ID, [First] & ' ' & [Last], tblOffices.OfficeName, tblPersonnel.First, tblPersonnel.Last, tblPersonnel.Status
HAVING (((tblPersonnel.First) Is Not Null) AND ((tblPersonnel.Last) Is Not Null) AND ((tblPersonnel.Status)=1))
ORDER BY [First] & ' ' & [Last];
G3r\Octel VMX 300
"Sanity is a goal, not a guarentee"
For instance:
tblOffices.ID PersonName OfficeName
289 Bob Smith Milwaukee
323 Bob Smith Bob Smith Home
Could I replace the Officename with a 1, a 2, etc.
SELECT tblOffices.ID, [First] & ' ' & [Last] AS PersonName, tblOffices.OfficeName
FROM tblOffices INNER JOIN tblPersonnel ON tblOffices.ID = tblPersonnel.OfficeID
GROUP BY tblOffices.ID, [First] & ' ' & [Last], tblOffices.OfficeName, tblPersonnel.First, tblPersonnel.Last, tblPersonnel.Status
HAVING (((tblPersonnel.First) Is Not Null) AND ((tblPersonnel.Last) Is Not Null) AND ((tblPersonnel.Status)=1))
ORDER BY [First] & ' ' & [Last];
G3r\Octel VMX 300
"Sanity is a goal, not a guarentee"