G
Guest
MS Access 2000, Win XP
===================
Hi,
This is probably quite simple, but I'm totally missing it, and need some
fresh eyes to look at this.
I have a form with a combo-box control that is used to select a name. The
names and their phone numbers are stored in a table called 'tblPerson'.
I also have unbound text control to display the phone number of the person
selected in the combo-box.
I'm setting this in the AfterUpdate event of the combo-box, using a DLookup.
Here's the code:
============================================
Private Sub cboHCTeamCoordinatorID_AfterUpdate()
Dim varHCCoordinatorPhone As Variant
varHCCoordinatorPhone = DLookup([PersonPhoneNumber], "tblPerson",
"[PersonID] = " & Me.cboHCTeamCoordinatorID.Value)
Me.txtHCCoordinatorPhone = varHCCoordinatorPhone
End Sub
===============================================
This gives me run-time error 2465, with the following : MS Access can't find
the field '|' referred to in your expression.
I've used different combinations in the code:
1. Instead of assigning the value to a variant, I've tried to assign it
directly to the unbound textbox.
2. In the criteria of Dlookup, I've used "Me.cboHCTeamCoordinatorID" and
"Me.HCTeamCoordinatorID" (that's the field in the table where value is stored.
I've checked and re-checked the table and field names, and they are correct
(or, I'm really being dense, which is a possibility
.
Any help will be appreciated.
Thanks.
-Amit
===================
Hi,
This is probably quite simple, but I'm totally missing it, and need some
fresh eyes to look at this.
I have a form with a combo-box control that is used to select a name. The
names and their phone numbers are stored in a table called 'tblPerson'.
I also have unbound text control to display the phone number of the person
selected in the combo-box.
I'm setting this in the AfterUpdate event of the combo-box, using a DLookup.
Here's the code:
============================================
Private Sub cboHCTeamCoordinatorID_AfterUpdate()
Dim varHCCoordinatorPhone As Variant
varHCCoordinatorPhone = DLookup([PersonPhoneNumber], "tblPerson",
"[PersonID] = " & Me.cboHCTeamCoordinatorID.Value)
Me.txtHCCoordinatorPhone = varHCCoordinatorPhone
End Sub
===============================================
This gives me run-time error 2465, with the following : MS Access can't find
the field '|' referred to in your expression.
I've used different combinations in the code:
1. Instead of assigning the value to a variant, I've tried to assign it
directly to the unbound textbox.
2. In the criteria of Dlookup, I've used "Me.cboHCTeamCoordinatorID" and
"Me.HCTeamCoordinatorID" (that's the field in the table where value is stored.
I've checked and re-checked the table and field names, and they are correct
(or, I'm really being dense, which is a possibility

Any help will be appreciated.
Thanks.
-Amit