=DLookUp("[PCC]","Location","[TXUsite] = Forms![Transactions]![TXUsite]")
This is returning nothing to my PCC field in my form. Where do I need to
place this funtion and is this correct?
What is the datatype of the [TXUsite]? Number or Text?
Is this code being placed in an event on theTransaction form or in a
control source of an UNBOUND control on that form? Or on a different
form? It makes a difference.
Assuming [PCC] and [TXUsite] are field's in the [Location] table, and
you have a form with a control named [TCUsite].....
1) As code in an event on the Transaction form assuming [TXUsite] is
text:
=DLookUp("[PCC]","Location","[TXUsite] = '" & Me![TXUsite] & "'")
If the [TXUsite] is a Number datatype then use:
"[TXUsite] = " & Me![TXUsite])
2) In a control source on that form:
=DLookUp("[PCC]","Location","[TXUsite] = '" [TXUsite] & "'")
If the [TXUsite] is a Number datatype then use:
"[TXUsite] = " & [TXUsite])
3) On a different form or in a Module:
=DLookUp("[PCC]","Location","[TXUsite] = '" &
Forms![Transactions]![TXUsite] & "'")
If the [TXUsite] is a Number datatype then use:
"[TXUsite] = " & Forms!Transaction![TXUsite])
The form "Transaction" must be open when the DLookUp is run.