Simple cascading Combobox's

G

Graham

Still struggling with this!
I can make three selections in my first combobox, Resource, which I then
want to populate my second combobox, Capability, with data held in three
separate tables.
I think the first combo is working OK, but the second fails to update. I
think it may have something to do with the RowSource property for that second
combobox ?
Should this be automatically populated from the code below, in the
AfterUpdate property of my first box ?
Also the debug doesn't like the [Capability] on the 5th. line, I get the
error message "External Name not defined", I've tried all sorts of
permutations but to no avail. It is happy with "[Resource]" on the third line
?
Can you specify whether you are referring to another Combobox or a Table
?Any suggestions ?

Private Sub Resource_AfterUpdate()
On Error Resume Next
Select Case "[Resource]"
Case "System Engineering Services"
[Capability].RowSource = "[SESPrimaryCapability]"
Case "Management Services"
[Capability].RowSource = "[MSPrimaryCapability]"
Case "Specialist Services"
[Capability].RowSource = "[SSPrimaryCapability]"
End Select
Me!Capability.RowSource.Requery
End Sub
 
N

NetworkTrade

you must add into ComboOne's 'AfterUpdate' event
me.ComboTwo.requery


this will refresh the second combo box.

presuming combobox2's underlying query has criteria defined in combo1 -
everything should work fine....
 
B

BruceM

Instead of:
Select Case "[Resource]"
try:
Select Case Me.Resource

It may work if you just remove the quotes, but the quotes cause Select Case
to evaluate the literal string "[Resource]" rather than the combo box value.
The quotes are correct for each Case (assuming that "System Engineering
Services", etc. are from the combo box's bound column) and for the named
queries in the RowSource property.

NetworkTrade said:
you must add into ComboOne's 'AfterUpdate' event
me.ComboTwo.requery


this will refresh the second combo box.

presuming combobox2's underlying query has criteria defined in combo1 -
everything should work fine....

--
NTC


Graham said:
Still struggling with this!
I can make three selections in my first combobox, Resource, which I then
want to populate my second combobox, Capability, with data held in three
separate tables.
I think the first combo is working OK, but the second fails to update. I
think it may have something to do with the RowSource property for that
second
combobox ?
Should this be automatically populated from the code below, in the
AfterUpdate property of my first box ?
Also the debug doesn't like the [Capability] on the 5th. line, I get the
error message "External Name not defined", I've tried all sorts of
permutations but to no avail. It is happy with "[Resource]" on the third
line
?
Can you specify whether you are referring to another Combobox or a Table
?Any suggestions ?

Private Sub Resource_AfterUpdate()
On Error Resume Next
Select Case "[Resource]"
Case "System Engineering Services"
[Capability].RowSource = "[SESPrimaryCapability]"
Case "Management Services"
[Capability].RowSource = "[MSPrimaryCapability]"
Case "Specialist Services"
[Capability].RowSource = "[SSPrimaryCapability]"
End Select
Me!Capability.RowSource.Requery
End Sub
 

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