Hello:
I have a form that has 3 combo boxes.
CboDivision
cboWrkReg
cboCreditReg
In the Field Properties, of those combo boxes I used the “Default Value” to populate selections that were made via another form I created.
[Forms]![DataEntry]![CboDivision]
[Forms]![DataEntry]![cboWrkReg]
[Forms]![DataEntry]![cboCreditReg]
My problem is that the cboWrkReg & cboCreditReg are displaying the ID number instead of the Name that it is tied to it. Because the cboCreditReg needs to be a cascading combo box I put the following code into the Load Event of the form:
[code=vb]
'Private Sub Form_Load()
'When the Working Region is selected, the appropriate Credit Region list will
'display in the drop down list of CboCreditReg
With Me![cboCreditReg]
If IsNull(Me!cboWr kReg) Then
.RowSource = ""
Else
.RowSource = "SELECT DISTINCT tblCreditRegion .CreditRegID, " & _
"tblCreditRegio n.CreditRegionN ame " & _
"FROM TblLocationsMM INNER JOIN tblCreditRegion " & _
"ON TblLocationsMM. CreditRegIDFK = tblCreditRegion .CreditRegID " & _
"WHERE [WrkRegIDFK]=" & Me!cboWrkReg
End If
Call .Requery
End With
End Sub
[/code]
Now the cboCreditReg displays the name but I still have my cboWrkReg displaying the ID.
Is there a way that I can get both my cboWrkReg and cboCreditReg to display the names by modifying slightly my code??
Any assistance would be greatly appreciated.
Thanks,
Keith.
I have a form that has 3 combo boxes.
CboDivision
cboWrkReg
cboCreditReg
In the Field Properties, of those combo boxes I used the “Default Value” to populate selections that were made via another form I created.
[Forms]![DataEntry]![CboDivision]
[Forms]![DataEntry]![cboWrkReg]
[Forms]![DataEntry]![cboCreditReg]
My problem is that the cboWrkReg & cboCreditReg are displaying the ID number instead of the Name that it is tied to it. Because the cboCreditReg needs to be a cascading combo box I put the following code into the Load Event of the form:
[code=vb]
'Private Sub Form_Load()
'When the Working Region is selected, the appropriate Credit Region list will
'display in the drop down list of CboCreditReg
With Me![cboCreditReg]
If IsNull(Me!cboWr kReg) Then
.RowSource = ""
Else
.RowSource = "SELECT DISTINCT tblCreditRegion .CreditRegID, " & _
"tblCreditRegio n.CreditRegionN ame " & _
"FROM TblLocationsMM INNER JOIN tblCreditRegion " & _
"ON TblLocationsMM. CreditRegIDFK = tblCreditRegion .CreditRegID " & _
"WHERE [WrkRegIDFK]=" & Me!cboWrkReg
End If
Call .Requery
End With
End Sub
[/code]
Now the cboCreditReg displays the name but I still have my cboWrkReg displaying the ID.
Is there a way that I can get both my cboWrkReg and cboCreditReg to display the names by modifying slightly my code??
Any assistance would be greatly appreciated.
Thanks,
Keith.
Comment