the left side of each equation (x = y) must be the name of a field in your
domain (CPSADMIN_MV_ANA_TIERS). because the function "opens" the domain,
just use the appropriate field name on the left side of the equation - don't
include a reference to the domain. the right side of the equation must be a
value that is available to the system at runtime - usually either a "hard"
value or a reference to a control on an open form. if you're refering to a
control on an open form, the syntax depends on where you're running the
DLookup function from.
also, each And must be inside the double quotes, not outside. i'll
assume all the following statements are true:
tier_num is a field in CPSADMIN_MV_ANA_TIERS.
tier_num is the value you want the DLookup function to return.
CPSADMIN_MV_ANA_TIERS is the name of a table or query in your database.
CLI_TYPE, CLAIM_TYPE, BEG_THRSHLD, and END_THRSHLD are all fields in
CPSADMIN_MV_ANA_TIERS.
you're running this function in an open form's VBA module.
cases is the name of the form.
CLI_TYPE, CLAIM_TYPE, and total are the names of fields in form cases,
and are all numeric data type, not text data type.
assuming the correctness of the above statements, the syntax would be
DLookUp("tier_num", "CPSADMIN_MV_ANA_TIERS", _
"CLI_TYPE = " & Me!CLI_TYPE & " And CLAIM_TYPE = " _
& Me!CLAIM_TYPE & " And BEG_THRSHLD <= " _
& Me!total & " And END_THRSHLD >= " & Me!total)
Me!CLI_TYPE refers to the CLI_TYPE field in the open form's RecordSource
property. ditto for Me!CLAIM_TYPE and Me!total.
see the DLookup Function Help topic in Access VBA Help for detailed
information on the function.
hth
Smallville said:
I am trying to run a DLooKUp to pull a ranking level. The problem is that
there are 4 sets of criteria to match on:
1) CLI_TYPE (txt)
2) CLAIM_TYPE (txt)
3) BEG_THRSHLD (num)
4) END_THRSHLD (num)
My statement is as follows:
DLookUp("[tier_num]","CPSADMIN_MV_ANA_TIERS","[cases]![CLI_TYPE]=[CPSADMIN_M
V_ANA_TIERS]![CLI_TYPE]"
And "[cases]![CLAIM_TYPE]=[CPSADMIN_MV_ANA_TIERS]![CLAIM_TYPE]" And "[total]
=[BEG_THRSHLD]" And "[total]<=[END_THRSHLD]")
I do not get an error, but I do not get the correct results. Any suggestions?
Thanks.