View Full Version : DLookup in Control Source


yuccakid
05-24-2000, 01:14 PM
I have entered a DLookup =DLookup("[Referral]","tblRefer","[ReferID]=" & Forms![frmReferral]!ReferID) and it works, but only if the frmReferral is Open. Anything I can do without having to open the other form?

Axis
05-24-2000, 02:44 PM
You have to pass along criteria for the DLookup to evaluate. Either you allow the user to pick criteria from a form (as you've already done) or you hardwire in a criterion that can't be changed by the user.

yuccakid
05-24-2000, 02:57 PM
Thanks, Axis. But how do I "hardwire a criterion"?

Axis
05-25-2000, 04:08 PM
By building it into the function, such as
DLookup("[Referral]","tblRefer","[ReferID]=1234")
Of course this has very limited application, since you'd always be looking up the same thing.
Where are you using the DLookup? Give me a better idea of the problems and I'll try to think of another solution for you.