match organization name to department name

K

KateM

I have a contacts database with a drop down list for organizations. When a
person picks the organization I need to have the department drop down show a
list of all the departments. This is just giving me 3 different departments
with their organization. Any suggestions??

SELECT tblDepartment.[Department Name], tblContacts.OrgName
FROM tblDepartment, tblContacts
WHERE (((tblContacts.OrgName)=[tblDepartment].[OrgName]) AND
((tblContacts.DeptName)=[tblDepartment].[Department Name]));
 
M

[MVP] S.Clark

Access uses ComboBoxes.

To base one combobox on another, use the after update of the first to set
the rowsource for the second.

e.g.

with cbo1
if not isnull(.value) then
cbo2.rowsource = "Select * from tablename where field = " & .value
else
cbo2.rowsource = "Tablename"
endif
end with

--
Steve Clark, Access MVP
FMS, Inc.
Call us for all of your Access Development Needs!
1-888-220-6234
[email protected]
www.fmsinc.com/consulting
 
K

KateM

I am not sure where that statement goes. This would go in place of what I
currently have?
--
Center for Governmental Research
Research/Technology


[MVP] S.Clark said:
Access uses ComboBoxes.

To base one combobox on another, use the after update of the first to set
the rowsource for the second.

e.g.

with cbo1
if not isnull(.value) then
cbo2.rowsource = "Select * from tablename where field = " & .value
else
cbo2.rowsource = "Tablename"
endif
end with

--
Steve Clark, Access MVP
FMS, Inc.
Call us for all of your Access Development Needs!
1-888-220-6234
[email protected]
www.fmsinc.com/consulting

KateM said:
I have a contacts database with a drop down list for organizations. When a
person picks the organization I need to have the department drop down show
a
list of all the departments. This is just giving me 3 different
departments
with their organization. Any suggestions??

SELECT tblDepartment.[Department Name], tblContacts.OrgName
FROM tblDepartment, tblContacts
WHERE (((tblContacts.OrgName)=[tblDepartment].[OrgName]) AND
((tblContacts.DeptName)=[tblDepartment].[Department Name]));
 
M

[MVP] S.Clark

This statement would be placed in the AfterUpdate VBA Procedure for the
first combobox.

KateM said:
I am not sure where that statement goes. This would go in place of what I
currently have?
--
Center for Governmental Research
Research/Technology


[MVP] S.Clark said:
Access uses ComboBoxes.

To base one combobox on another, use the after update of the first to set
the rowsource for the second.

e.g.

with cbo1
if not isnull(.value) then
cbo2.rowsource = "Select * from tablename where field = " & .value
else
cbo2.rowsource = "Tablename"
endif
end with

--
Steve Clark, Access MVP
FMS, Inc.
Call us for all of your Access Development Needs!
1-888-220-6234
[email protected]
www.fmsinc.com/consulting

KateM said:
I have a contacts database with a drop down list for organizations. When
a
person picks the organization I need to have the department drop down
show
a
list of all the departments. This is just giving me 3 different
departments
with their organization. Any suggestions??

SELECT tblDepartment.[Department Name], tblContacts.OrgName
FROM tblDepartment, tblContacts
WHERE (((tblContacts.OrgName)=[tblDepartment].[OrgName]) AND
((tblContacts.DeptName)=[tblDepartment].[Department Name]));
 
Top