Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using dlookup, nothing returning

Status
Not open for further replies.

jalge2

Technical User
Feb 5, 2003
105
US
Hi all. Gotta question. I'm using dlookup to return information in a table. The information is coming from the Inventory table. When I select a part description in a combo box, I want the part number displayed in the text box. The dlookup string that I have is this

=DLookUp("[Description]","Inventory","[Part Number]=forms!frmservice!subfrmInventory![txtpartnumber]")

This looks correct to me, but when I run this nothing returns. #error used to return, but now there is nothing. Can someone help me out here and tell me what I'm missing?

Thanks.

Jason Alge
Jason.M.Alge@lowes.com

'There are three kinds of people: Those who can count and those who can't'
 
If NULL is returned, that means not found. Is the part number alphanumeric? If so, you need single quotes surrounding the part number.
 
Hi!

[tt]=DLookUp("[Description]","Inventory","[Part Number]=" & forms!frmservice!subfrmInventory.Form![txtpartnumber])[/tt]

Two things:
1 - usually one would pass the value in the criteria, not the reference
2 - referencing subforms, add the form keyword - another note - one would need to use the subform control name which might be different from the name of the subform as vieved in the database window.

Here's a Microsoft link on How to Refer to a Control on a Subform or Subreport

Roy-Vidar
 
Hi,
One more thing to check. The text box cannot be the name of a field from the field list. It MUST be an unbound text box.

HTH, [pc2]
Randy Smith, MCP
rsmith@cta.org
California Teachers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top