Populate a combo box from another combo box

S

short

I have two combo boxes cmbApp and cbName
cmbApp RowSource is this: SELECT Application.ID, Application.Name FROM
Application;

And cbName is this:
Me.cbName.RowSource = "SELECT Deployment.[Verison] FROM Deployment INNER
JOIN (Application INNER JOIN Deployment_Application ON Application.[ID] =
Deployment_Application.[ApplicationID]) ON Deployment.[ID]=
Deployment_Application.[DeploymentID]) WHERE
Application.[Name]=[Forms]![UpdateInformation]!cmbApp"

cmbApp works, but cbName shows nothing at all. Please help.
Thanks,
 
B

Beetle

A few things to note here.

First, just as a point of information, you shouldn't use the word Name
as a field name as it is a reserved word and using it as a field name can
cause problems. For more reserved words see;

http://allenbrowne.com/AppIssueBadWord.html

Second, your cmdApp combo box displays the Application Name, but it
stores the Application ID (at least that appears to be the case), so
criteria like;

Application.[Name]=[Forms]![UpdateInformation]!cmbApp

will never return a match.

Thirs, I could be wrong, but from your cmbName Row Source it
appears that you have a many-to-many relationship between your
Application table and your Deployment table, which is being controlled
by your Deployment_Application table. If this is the case, then what
are you wanting to accomplish with these combo boxes?
 
M

Marshall Barton

short said:
I have two combo boxes cmbApp and cbName
cmbApp RowSource is this: SELECT Application.ID, Application.Name FROM
Application;

And cbName is this:
Me.cbName.RowSource = "SELECT Deployment.[Verison] FROM Deployment INNER
JOIN (Application INNER JOIN Deployment_Application ON Application.[ID] =
Deployment_Application.[ApplicationID]) ON Deployment.[ID]=
Deployment_Application.[DeploymentID]) WHERE
Application.[Name]=[Forms]![UpdateInformation]!cmbApp"

cmbApp works, but cbName shows nothing at all. Please help.


I do not see why you need the Application table in cbName's
row source. The application ID in Deployment_Application
shoild be sufficient.

Check cmbApp's BoundColumn property, you probably need the
Where clause to be:

Application.ID=[Forms]![UpdateInformation]!cmbApp

OR, if you can remove the Application table from the query,


Deployment_Application.ID=[Forms]![UpdateInformation]!cmbApp
 
S

short

That works! Thanks.

Marshall Barton said:
short said:
I have two combo boxes cmbApp and cbName
cmbApp RowSource is this: SELECT Application.ID, Application.Name FROM
Application;

And cbName is this:
Me.cbName.RowSource = "SELECT Deployment.[Verison] FROM Deployment INNER
JOIN (Application INNER JOIN Deployment_Application ON Application.[ID] =
Deployment_Application.[ApplicationID]) ON Deployment.[ID]=
Deployment_Application.[DeploymentID]) WHERE
Application.[Name]=[Forms]![UpdateInformation]!cmbApp"

cmbApp works, but cbName shows nothing at all. Please help.


I do not see why you need the Application table in cbName's
row source. The application ID in Deployment_Application
shoild be sufficient.

Check cmbApp's BoundColumn property, you probably need the
Where clause to be:

Application.ID=[Forms]![UpdateInformation]!cmbApp

OR, if you can remove the Application table from the query,


Deployment_Application.ID=[Forms]![UpdateInformation]!cmbApp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top