needing dlookup assistance

G

Guest

I have 2 fields that form to make a file numbering process. One field is
FileLetter and the other is FileNo. I need to do a dlookup based on the
combination of both letter and number. I am able to do one of the fields but
not both. How do I concatenate them in the following dlookup?

DLookup("[FileNo]", "tbl_Clients", "[FileNo] =" & Me!txtFileNo & "")

Thanks for any assistance.
\\\ John
 
F

fredg

I have 2 fields that form to make a file numbering process. One field is
FileLetter and the other is FileNo. I need to do a dlookup based on the
combination of both letter and number. I am able to do one of the fields but
not both. How do I concatenate them in the following dlookup?

DLookup("[FileNo]", "tbl_Clients", "[FileNo] =" & Me!txtFileNo & "")

Thanks for any assistance.
\\\ John

I'm not at all clear on what you want.
What do you mean by 'concatenate them' in the DLookUp?
Are you trying to LookUp two fields in the one DLookUp?
Or are you trying to use 2 fields in the criteria?

Note: You are looking up [FileNo] yet you already know what FileNo is
(because your code says [FileNo] = txtFileNo)

Anyway, your criteria clause above is not correctly written.
If FileNo is a Number datatype then:

"[FileNo] =" & Me!txtFileNo)

However if FileNo is Text datatype, then you need to include a ' after
the = sign.:

"[FileNo] ='" & Me!txtFileNo & "")

Post back with a bit more information, letting us know the exact field
names and their datatypes, with an example of what data you expect.
 
J

John W. Vinson

I have 2 fields that form to make a file numbering process. One field is
FileLetter and the other is FileNo. I need to do a dlookup based on the
combination of both letter and number. I am able to do one of the fields but
not both. How do I concatenate them in the following dlookup?

DLookup("[FileNo]", "tbl_Clients", "[FileNo] =" & Me!txtFileNo & "")

Thanks for any assistance.
\\\ John

I'm in agreement with Fred that your question is a bit unclear! But if you
have two independent criteria, you can create a string (basically a SQL WHERE
clause without the word WHERE) combining them:

DLookup("[FileNo]", "tbl_Clients", "[FileNo] ='" & Me!txtFileNo & "' AND
[FileLetter] = '" & Me!txtFileLetter & "'")

This will give a third argument resembling

[FileNo] = '123' AND [FileLetter] = 'K'


John W. Vinson [MVP]
 

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