Dlookup with multiple creteria

ootkhopdi

Registered User.
Local time
Today, 23:48
Joined
Oct 17, 2013
Messages
181
Hi

pls tell me how can i set creteria in dlookup
as =dlookup("Fieldname=1,Tablename=2,creteria1=3,creteria2=4 and creteria 3=5

pls help me

i m new user of access 2007
 
Well first off, why use a DLookup, in 99% of all cases they are overused ...

What have you tried to do that didnt work?
 
i want to find a value from table on creteria
creteria 1= text, creteria 2= year or number and creteria 3 = text

pls give me solution
 
Well first off, why use a DLookup, in 99% of all cases they are overused ...

What have you tried to do that didnt work?

Well first off, why use a DLookup, in 99% of all cases they are overused ...

What have you tried to do that didnt work?

Seriously, Dlookups are not great to use overall... particularly if you use more than one.....

Anyways the criteria is a single string, so you have to write it like you would SQL
Code:
"Field1 = 'SomeText' and Field2 = 2015 and field3 = #15/08/2015#"
Or if you want to substitute in variables.
Code:
"Field1 = '" & SomeVar &"' and Field2 = " & Var2 &" and field3 = #" &Format(Vardate, "MM/DD/YYYY") & "#"
 
i dont understand it

pls give me code as
Me.Text6 = DLookup("[" & Me.Combo2 & "]", "SalaryRural2009toUpdate", "Empid='" & Me.Combo0 & "' and salmonth= "& feb & " and salyear="&2015")
it says >syntax error
what is the error
pls tell me and how can i solve it
 
what is the error
pls tell me and how can i solve it

Well for starters you have a quote to many at the end....

also depending on, but I will assume feb and 2015 are constants....
That would make it be something like:
Code:
"Empid='" & Me.Combo0 & "' and salmonth= 'feb' and salyear=2015"
 
it is not working
it shows #Error
i placed 1 creteria as combo box value and second is name of month and third is year

as 1st creteria is combo0
2nd is "feb"
3rd is "2015"

how can i concatenate all of these creterias

pls help me
 
Is EmpID by chance a number field?

Code:
DLookup("[" & Me.Combo2 & "]", "SalaryRural2009toUpdate","Empid=" & Me.Combo0 & " and salmonth= 'feb' and salyear=2015"
This assumes
EmpID is a number dield
SalMonth is a text field
salyear is a number field
 
thanks

empid is text field
feb is text field

can i replace 2015 as Lebal caption value

is yes how can
 

Users who are viewing this thread

Back
Top Bottom