One for the Division location:
tblDivision
DivisionID = Autonumber
DivisionName = Text
One for the Working Region:
tblWrkRegion
WrkRegID = Autonumber
WrkRegionName = Text
DivisionID = Number (This is for my one to many relationship; a Division can have many different working regions)
One for the Credit Region:
tblCreditRegion
CreditRegID = Autonumber
CreditRegion = Text
WrkRegID = Number (This is for my one to many relationship; a working region can have many different credit regions)
I followed the cascading script method posted on this website and created a form, put 3 combo boxes on it:
cboDivision (bound on column 1, row source tblDivision, column count set to 2)
cboWrkReg (bound on column 1, row source blank, column count set to 1)
cboCreditReg (bound on column 1, row source blank, column count set to 1)
In the after update event of my cboDivision I placed the following code:
Expand|Select|Wrap|Line Numbers
- Private Sub CboDivision_AfterUpdate()
- 'When the Division is selected, the appropriate Working Region list will
- 'display in the drop down list of CboWrkReg
- With Me![CboWrkReg]
- If IsNull(Me!CboDivision) Then
- .RowSource = ""
- Else
- .RowSource = "SELECT [WrkRegionName] " & _
- "FROM TblWrkRegion " & _
- "WHERE [DivisionID]=" & Me!CboDivision
- End If
- Call .Requery
- End With
- End Sub
This worked great. The Divisions would populate and when I clicked on cboWrkReg the working region list would be there. So….. I needed my last combo box to act and behave in the same way so In the after update event of my cboWrkReg I placed the following code:
Expand|Select|Wrap|Line Numbers
- Private Sub cboWrkReg_AfterUpdate()
- 'When the Working Region is selected, the appropriate Credit Region list will
- 'display in the drop down list of CboCredit Reg
- With Me![CboCreditReg]
- If IsNull(Me!CboWrkReg) Then
- .RowSource = ""
- Else
- .RowSource = "SELECT [CreditRegion] " & _
- "FROM TblCreditRegion " & _
- "WHERE [WrkRegID]=" & Me!CboWrkReg
- End If
- Call .Requery
- End With
- End Sub
If I key in the ID number for Atlanta the drop down box (cboCreditReg) will populate with the appropriate list. If I do nothing it will be blank or give me a syntax error message.
I have tried several things like changing bound columns with no luck. Does anybody have any idea where I am going wrong? I thought I solved this issue before I introduced a third cascading combo box.
Any help would be greatly appreciated.
Thanks,