Dlookup

T

Tom

HI there

I am using the dlook up function, and its working fine
till i dont use the criteria, once i put in the criteria
it dosent work.
Following is the code which is not working

Dim varX As Variant
varX = DLookup("[F_Flag]", "Flag Support", "[P_Name]=" &
Forms![output calculation]!P_Name)

If i remove the criteria itw working fine.

I would appreciate if someone would help me on this.

Thank you.
 
D

Douglas J. Steele

What is P_Name: a text field? If so, you need to enclose the value you're
passing in quotes:

Dim varX As Variant
varX = DLookup("[F_Flag]", "Flag Support", "[P_Name]=" & Chr$(34) &
Forms![output calculation]!P_Name & Chr$(34))

Chr$(34) returns ", in case you were wondering.
 

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

Similar Threads


Top