Help with DLookup

  • Thread starter Thread starter Ayo
  • Start date Start date
A

Ayo

I am trying to use the Expression below but I am getting a "#Error", any
ideas what I am doing wrong?
Thanks
Ayo

=DLookUp("[Type]","Actuals","[Project Number] =" & [Forms]![Form1]![Project
Number])
 
Hi Ayo,

Is [Project Number] a numeric or text field? Where are you using this
function?

Clifford Bass
 
[Project Number] is a text field. I am using the function in the Control
Source of a TextBox

Clifford Bass said:
Hi Ayo,

Is [Project Number] a numeric or text field? Where are you using this
function?

Clifford Bass

Ayo said:
I am trying to use the Expression below but I am getting a "#Error", any
ideas what I am doing wrong?
Thanks
Ayo

=DLookUp("[Type]","Actuals","[Project Number] =" & [Forms]![Form1]![Project
Number])
 
Hi Ayo,

Ah, that is the issue. For text fields you need to make sure you quote
the text.

=DLookUp("[Type]","Actuals","[Project Number] = """ &
[Forms]![Form1]![Project Number] & """")

Or, if there is any chance that a quote symbol could occur in [Project
Number], you will need to make sure those are doubled-up also:

=DLookUp("[Type]","Actuals","[Project Number] = """ &
Replace([Forms]![Form1]![Project Number], """", """""") & """")

Hopefully that will do it,

Clifford Bass
 
Thanks Clifford. I completely forgot abot that. It works great now.

Clifford Bass said:
Hi Ayo,

Ah, that is the issue. For text fields you need to make sure you quote
the text.

=DLookUp("[Type]","Actuals","[Project Number] = """ &
[Forms]![Form1]![Project Number] & """")

Or, if there is any chance that a quote symbol could occur in [Project
Number], you will need to make sure those are doubled-up also:

=DLookUp("[Type]","Actuals","[Project Number] = """ &
Replace([Forms]![Form1]![Project Number], """", """""") & """")

Hopefully that will do it,

Clifford Bass

Ayo said:
[Project Number] is a text field. I am using the function in the Control
Source of a TextBox
 
Back
Top