Re: Cascading Combo boxes using CASE command
- From: "Jeanette Cunningham" <nnn@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 3 Oct 2008 21:17:41 +1000
Hi Agnelo
you need the correct syntax to 'talk' to the subform.
The name of the subform control is important.
A subform is always inside a subform control on the main form.
The name of the subform control can be, and often is, different from the
name of the subform inside it.
To talk to cboCity when it is on the subform you use syntax like this:
Me.[NameOfSubformControl].Form.cboCity
instead of just cboCity
Code something like this:
Private Sub cboCountry_AfterUpdate()
On Error Resume Next
Dim strTableName as String
Select Case cboCountry.Value
Case "France"
strTableName = "tblFrance"
Case "United Kingdom"
strTableName = "tblUnitedKingdom"
Case "United States"
strTableName = "tblUnitedStates"
End Select
Me.[NameOfSubformControl].Form.cboCity.RowSource = strTableName
End Sub
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
"Agnelo Fernandes" <AgneloFernandes@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:9BD4E04B-3FB8-4255-9E92-7147806BD166@xxxxxxxxxxxxxxxx
I tried setting up a cascading combo box between countries and cities i.e
based on the country u select , you can view the appropriate cities in the
other combo box.
I tried using CASE command in 'after update' of country combo box:
Private Sub cboCountry_AfterUpdate()
On Error Resume Next
Select Case cboCountry.Value
Case "France"
cboCity.RowSource = "tblFrance"
Case "United Kingdom"
cboCity.RowSource = "tblUnitedKingdom"
Case "United States"
cboCity.RowSource = "tblUnitedStates"
End Select
End Sub
This works fine but now I need 'cities' combo box to be in SubForm. So
based
on the option I select in Countries [on MainForm] I should get the
appropriate cities [on SubForm] by using CASE function...Any help
.
- Follow-Ups:
- Re: Cascading Combo boxes using CASE command
- From: Agnelo Fernandes
- Re: Cascading Combo boxes using CASE command
- From: Agnelo Fernandes
- Re: Cascading Combo boxes using CASE command
- References:
- Cascading Combo boxes using CASE command
- From: Agnelo Fernandes
- Cascading Combo boxes using CASE command
- Prev by Date: Multi Drop Down Field Lookup
- Next by Date: Re: Show Oldest Record First in subForm
- Previous by thread: Cascading Combo boxes using CASE command
- Next by thread: Re: Cascading Combo boxes using CASE command
- Index(es):
Relevant Pages
|
Loading