Hi Chad -
First of all, in the criteria the name of the fieldname should be
first followed by the test value. The fieldname should not be
prefixed with the table name. So as a simple example lets say you
want to find the record with IRN=999:
=DLookup("[Cont_Auth]", "[tblProgram]","IRN = 999")
Since your test value (999) is in a control you have to build the
criteria by appending the value to the criteria. Note that the
reference to the control on the form is *outside* of the quotes.
When VBA executes this statement it will resolve the control
reference with the control's value. So now your statement becomes:
=DLookup("[Cont_Auth]", "[tblProgram]","IRN =" & Forms!frmTSD!cboIRN)
To add another condition you just append the second field name with
the And operator:
=DLookup("[Cont_Auth]", "[tblProgram]","IRN =" & Forms!frmTSD!cboIRN
& " AND Master=" & Forms!frmTSD!Master)
*I don't know where your second test value is really coming from - it
appears that you're trying to reference a field in another table but
this doesn't really make sense here.
--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.
oCan someone please Help Me out? I know I have the syntax wrong but
I am not sure f how to fix it. I have the following DLookup
function populating a textbox but it isnt working:
=DLookup("[Cont_Auth]", "[tblProgram]",
"Forms!frmTSD!cboIRN=[tblWrkPkg!IRN] AND [tblWrkPkg!Master] =
[tblProgram!Master]")
Thanks in advance,
Chad