Form doesn't save dlookup value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form for data entry to a table. The control source for the Client
Number field is the result of a dlookup -
DLookUp("[ClientNumber]","[qryGetClientNumber]","[FullName]='" &
[Forms]![FrmComboBoxFullName]![cmbFullName] & "'"). The dlookup returns the
right value into the field, but when I finish with the data entry for the
rest of the fields, the ClientNumber saved is 0 - not the dlookup result.
What am I missing? Thanks for your help
 
Jenny said:
I have a form for data entry to a table. The control source for the
Client Number field is the result of a dlookup -
DLookUp("[ClientNumber]","[qryGetClientNumber]","[FullName]='" &
[Forms]![FrmComboBoxFullName]![cmbFullName] & "'"). The dlookup
returns the right value into the field, but when I finish with the
data entry for the rest of the fields, the ClientNumber saved is 0 -
not the dlookup result. What am I missing? Thanks for your help

A control is either bound to a field or contains an expression. It cannot
do both at the same time.
 
Rick is correct. The solution is to set the control source to [ClientNumber]
and put the DLookUp in the After Update event of cmbFullName as:
[Forms]![FrmComboBoxFullName]![ClientNumber} =
DLookUp("[ClientNumber]","[qryGetClientNumber]","[FullName]='" &
[Forms]![FrmComboBoxFullName]![cmbFullName] & "'")
 
Back
Top