Expand|Select|Wrap|Line Numbers
- Private Sub CboDivision_AfterUpdate()
- 'When the Division is selected, the appropriate Segment list will
- 'display in the drop down list of CboSegment
- With Me![cboSegment]
- If IsNull(Me!cboDivision) Then
- .RowSource = ""
- Else
- .RowSource = "SELECT DISTINCT tblSegment.SegmentID, " & _
- "tblSegment.SegmentName " & _
- "FROM TblLocationsMM INNER JOIN tblSegment " & _
- "ON TblLocationsMM.SegmentIDFK = tblSegment.SegmentID " & _
- "WHERE [DivisionIDFK]=" & Me!cboDivision
- End If
- Call .Requery
- 'Have the first dropdown list of cboSegment visible
- If Me![cboSegment].ListCount > 0 Then
- Me![cboSegment] = Me![cboSegment].Column(0, 0)
- End If
- End With
- End Sub
Expand|Select|Wrap|Line Numbers
- Private Sub cboSegment_AfterUpdate()
- 'First Make sure other combo boxes are null
- Me!cboWrkReg = Null
- Me!cboCreditReg = Null
- Me!cboBrokerType = Null
- 'When the Segment is selected, the appropriate Working Region list will
- 'display in the drop down list of CboWrkReg
- With Me![cboWrkReg]
- If IsNull(Me!cboSegment) Then
- .RowSource = ""
- Else
- .RowSource = "SELECT DISTINCT tblWrkRegion.WrkRegID, " & _
- "tblWrkRegion.WrkRegionName " & _
- "FROM TblLocationsMM INNER JOIN tblWrkRegion " & _
- "ON TblLocationsMM.WrkRegIDFK = tblWrkRegion.WrkRegID " & _
- "WHERE [DivisionIDFK]=" & Me!cboDivision & _
- "And [SegmentIDFK]=" & Me!cboSegment
- End If
- Call .Requery
- 'Have the first dropdown list of cboWrkReg visible
- If Me![cboWrkReg].ListCount > 0 Then
- Me![cboWrkReg] = Me![cboWrkReg].Column(0, 0)
- End If
- End With
- End Sub
If I do click/select [cboSegment] even though the first on the list is my choice the list choices in [cboWrkReg] are correct.
Now to my question, is there a simple code that I can put into my cboDivision_AfterUpdate that will not only display the first on the list but will trigger a click/select action so that the appropriate lists for subsequent combo boxes on the form will be correct?
I am thinking the solution I would apply to my other combo box AfterUpdate events but I am lost on how to solve...
Thanks for any ideas you may have.
Keith.