Dlook for text with 2 criteria

theinviter

Registered User.
Local time
Today, 12:35
Joined
Aug 14, 2014
Messages
273
HI guys ,
need help please,
i am designing a query for report and i am having field name drug name in query, where the user can enter drug name in the form so what i want is that;
to dlookup for the drug selected by user in Drug list (Table) to match the selected drug with 1- Drug name (text) and 2- chemo_drug (yes/No) and display only drug that match 2 criteria.

i tried this code

DLookUp("[drug name]","[drug list]","[drug name] ='" & [Drug name] & " AND [Chemo_drug]= " & "0" & "'")

but sow no record.
 
Hi. What do you get with this?
Code:
 DLookUp("[drug name]","[drug list]","[drug name] ='" & [Drug name] & "' AND [Chemo_drug]=0 ")
 
Try this
Code:
DLookUp("[drug name]","[drug list]","[drug name] ='" & [Drug name] & "' AND [Chemo_drug]= 0")

However using DLookup in a query will be slow. There may be better ways.
Can you post the SQL for your query
 
I would ask, why are you looking up drug name when you are supplying drug name? :confused:
 
because i need to filter report based on selected drug.

Whoosh.

If you need to do that, why not just use the selected drug name to do so? What does the Dlookup do?
 
because i have 2 report each will show data based on check mark (YES/NO) option
 

Users who are viewing this thread

Back
Top Bottom