Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dlookup with Like 1

Status
Not open for further replies.

end922

Technical User
Apr 17, 2007
59
0
0
US
Greetings, I am trying to do a Dlookup in a query with Like.
I import a table that has acct #s like ###-#####-##
(field name [F6]) I want to flag accounts that are on my list. So I created a table called range with a field called ID and added in the first ### (the other digits are NA to me) to the field. It doesn't seem to work. Any suggestions?

Thanks
E

My dlookup looks like this
Code:
Keep: DLookUp("[ID]","Range","[ID] like '[F6]*'")
 
Code:
Keep: DLookUp("[ID]","Range","[F6] Like [ID] & '*'")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 



Hi,

Why are you using a DLookup in a query?

Why not simply...
Code:
...
Where Left([ID],3) = [F6]


Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Sorry for the typo:
Code:
Keep: DLookUp("[ID]","Range","'" & [F6] & "' Like [ID] & '*'")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you PHV. 2nd works great. You the man!

Skip. Would have used yours if the RANGE table was in the query. There is no way to join it so a lookup seemed my only option.

Thanks Guys for your immediate response and solution.

E
 
There is no way to join it
Really ?
You may try this:
SELECT *
FROM ImportedTable I INNER JOIN Range R ON R.ID=Left([F6],3)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I will try.
table name is ImportBD2 field F6
What is the I after ImportedTable mean?
 
It's an alias.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 


Simply an alias: I for Import; R for Range

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
join expression not supported.

Code:
SELECT *
FROM Range INNER JOIN ImportBD2 ON Range.ID = left([ImportBD2]![F6],3);

Code:
 select *
FROM ImportBD2 I INNER JOIN Range R  ON R.ID=Left([F6],3);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top