473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Problem with limiting content from one Combo box to another.

Hello All,
I am having trouble with this forum I am developing in Access; I have
two combo boxes, one containing the Director info, and the other
containing the Manager info. Now what I want to happen is when
someone selects a specific Director when they go to choose the Manager
only the managers assigned to that Director to appear. In the
director combo box (which is called "ComboDirector") contains three
fields in it the "DirectorID" (column 0), "DirectorLastName" (column
1), and "DirectorFirstName" (column 2). and it's connected to the
table called "tblDirector". The manager combo ("ComboManager")
contains four fields, "ManagerID" (column 0), "ManagerFirstName"
(column 1), "ManagerFirstName" (column 2), and "DirectorID" (column
3), and it's connected to the table called "tblManager".
Now I tried to set in the RowSource query for the ManagerCombo so
that the DirectorID field equals the DirectorID field in the
DirectorCombo box, here is the example of the code:

SELECT tblManager. ManagerID, tblManager. ManagerLastName, tblManager.
ManagerFirstName
FROM tblManager INNER JOIN List_Director ON tblManager.DIRECTORADP =
List_Director. DirectorID
WHERE (((tblManager. DirectorID) Like [Forms]![frmEmployee]!
ComboDirector.Column(0)))

This doesn't work always giving me an error and leaving the contents
of the ComboManager blank.

If anyone can help me out with this problem I'd very much appreciate
it.
Nov 12 '05 #1
1 2518
The row source for the manager combo box should be:

SELECT ManagerID,ManagerLastName,ManagerFirstName
FROM tblManager
WHERE DirectorID = Forms!frmEmployee.ComboDirector

(You could create a saved query like this or enter the SQL directly into the
RowSource).

I'm assuming that the bound field of ComboDirector is DirectorID.

You will need some code to refresh ComboManager:

Me.ComboManager.Requery

This could go either in the AfterUpdate event of ComboDirector, or in the
OnEnter event of ComboManager - I'm not sure which is best or if it matters.

Alternatively you could generate the SQL for ComboManager in the AfterUpdate
event of ComboDirector, something like this:

Dim strSQL as string

strSQL = "SELECT ManagerID,ManagerLastName,ManagerFirstName "
strSQL = strSQL & "FROM tblManager "
strSQL = strSQL & "WHERE DirectorID = " & Me.ComboDirector

Me.ComboManager.RowSource = strSQL
"Bobbak" <bo****@ottawa.com> wrote in message
news:64**************************@posting.google.c om...
Hello All,
I am having trouble with this forum I am developing in Access; I have
two combo boxes, one containing the Director info, and the other
containing the Manager info. Now what I want to happen is when
someone selects a specific Director when they go to choose the Manager
only the managers assigned to that Director to appear. In the
director combo box (which is called "ComboDirector") contains three
fields in it the "DirectorID" (column 0), "DirectorLastName" (column
1), and "DirectorFirstName" (column 2). and it's connected to the
table called "tblDirector". The manager combo ("ComboManager")
contains four fields, "ManagerID" (column 0), "ManagerFirstName"
(column 1), "ManagerFirstName" (column 2), and "DirectorID" (column
3), and it's connected to the table called "tblManager".
Now I tried to set in the RowSource query for the ManagerCombo so
that the DirectorID field equals the DirectorID field in the
DirectorCombo box, here is the example of the code:

SELECT tblManager. ManagerID, tblManager. ManagerLastName, tblManager.
ManagerFirstName
FROM tblManager INNER JOIN List_Director ON tblManager.DIRECTORADP =
List_Director. DirectorID
WHERE (((tblManager. DirectorID) Like [Forms]![frmEmployee]!
ComboDirector.Column(0)))

This doesn't work always giving me an error and leaving the contents
of the ComboManager blank.

If anyone can help me out with this problem I'd very much appreciate
it.

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the...
5
by: mik18 | last post by:
Is there a limit to the number of rows a combo box can contain within Access 2002? I have a list of drug names with all the NDC codes which contains over 200,000 records. I do have this filtered...
3
by: joni b | last post by:
I need help limiting the options shown in a combo box. I have two combo boxes that appear in a datasheet view subform. The form looks like an Excel spreadsheet, which is what the user prefers....
2
by: Mark | last post by:
All, I have read the article on the MVP site regarding this topic (http://www.mvps.org/access/forms/frm0028.htm) but I am having some problems implementing it. I have a lookup table which...
7
by: callawayglfr | last post by:
I am building a database in access where I have a drop down box that relates to a text box, that part I have working but when someone selects information from the first drop down I need it to limit...
1
by: cybervegan | last post by:
I read, and grokked the following thread: http://www.thescripts.com/forum/thread577386.html and it worked for me initially. However, I tried using it on a an AutoForm generated form, which...
2
by: shivendravikramsingh | last post by:
hello friend,i m using this code<div id="get" style="visibility:hidden"><? include "time_title.php" ?></div> in a php page,i want when page load the inclued page time_tiltle.php should not shown,when...
1
by: seeing what is out there | last post by:
I'm new to Access, and it seems each time I try to do something that I consider simple ... I can't figure out how Access wants me to do it. I"m trying to build a program to track my dart leagues...
4
WyvsEyeView
by: WyvsEyeView | last post by:
I have a datasheet form in which one field is a combo box that will potentially contain hundreds of records. I've read about several methods of speeding up such combo boxes or limiting their initial...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.