Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Populate a combo box from another combo box

Geek News

Populate a combo box from another combo box
short 12/18/2008 4:28:01 PM
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,
RE: Populate a combo box from another combo box
Beetle 12/18/2008 5:51:03 PM
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?

--
_________

Sean Bailey


"short" wrote:

[Quoted Text]
> 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,
Re: Populate a combo box from another combo box
Marshall Barton <marshbarton[ at ]wowway.com> 12/18/2008 5:56:44 PM
short wrote:

[Quoted Text]
>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

--
Marsh
MVP [MS Access]
Re: Populate a combo box from another combo box
short 12/18/2008 6:14:02 PM
That works! Thanks.

"Marshall Barton" wrote:

[Quoted Text]
> short wrote:
>
> >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
>
> --
> Marsh
> MVP [MS Access]
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net