Help with DLookup

mpaulbattle

Registered User.
Local time
Yesterday, 21:43
Joined
Nov 30, 2017
Messages
56
Trying to use dlookup for the first time to see if I can pull the contract name from the table.

=DLookUp("[eCWContractName]","tblPractices","[PracticeID_PK]='" & [Forms]![frmPracticeList]![PracticeID_PK] & "'")

Found this link,http://www.theaccessweb.com/general/gen0018.htm, in an old post and tried to build it from the examples there but i am getting a #type in the textbox.

The only thing i noticed is after the criteria access is forcing the brackets.
 
normally, IDs tend to be numeric, if yours is so, remove the string quotes.
numbers don't get quotes:


DLookUp("[eCWContractName]","tblPractices","[PracticeID_PK]=" & [Forms]![frmPracticeList]![PracticeID_PK] )
 
Hi. What is the data type of PracticeID_PK?
 
normally, IDs tend to be numeric, if yours is so, remove the string quotes.
numbers don't get quotes:


DLookUp("[eCWContractName]","tblPractices","[PracticeID_PK]=" & [Forms]![frmPracticeList]![PracticeID_PK] )

Ranman256...Removed the string quotes and still getting the #type
 
This syntax seems SLIGHTLY awkward. Is the thing you are trying to find also on the form named frmPracticeList? Because if it is not, that reference only works if the form is open. The Forms collection is only OPEN forms.

But if the textbox using the DLookup IS on the same form, you don't need the [Forms]! prefix.
 

Users who are viewing this thread

Back
Top Bottom