how to auto-fill text box with the dlookup function in access

Viewed 94

I am trying to auto-full a text box using the Dlookup function, as below:

=DLookUp("[CustomerFACT]![ID name]","CustomerFACT","[CustomerFACT]![ID number] = " & [Forms]![NewLoanForm_2]![ID number])
  1. My original column names have spaces between them
  2. It seems that the code works, only after I input an ID, it fills the text box with #Error

Thanks in advance

1 Answers

Try this simpler syntax:

=DLookUp("[ID name]","[CustomerFACT]","[ID number] = " & [ID number] & "")

or, if ID number is text:

=DLookUp("[ID name]","[CustomerFACT]","[ID number] = '" & [ID number] & "'")
Related