Help with DLookup

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])
 
C

Clifford Bass

Hi Ayo,

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

Clifford Bass
 
A

Ayo

[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])
 
C

Clifford Bass

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
 
A

Ayo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top