Wrox Programmer Forums
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 9th, 2006, 12:17 PM
Authorized User
Join Date: Aug 2004
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default DLookup

I have a form I am using to enter customer orders. When I enter the Customer ID I want the Customer Name field to automatically populate with the customers name. I know I should use DLookup for this, but I am having a hard time figuring it out. I will explain more of what I don't understand later, but for now can someone help me get this straight?

Old August 9th, 2006, 11:48 PM
Registered User
Join Date: Jun 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

Hi, try this

txt_CustomerName = DLookup("[fld_CustomerName]", "tbl_Customer", "[fld_CustomerID] = '"& Forms![frm_Orders]![txt_CustomerID]&"'")

textbook that u going to display = DLookUp("[the column you want]", "[from the tble name]", "[the column u want to compare with] = '"& Forms![form name]![textbox of the form use to compare] &"'")

Similar Threads
Thread Thread Starter Forum Replies Last Post
dlookup problem alemok Access 0 April 17th, 2008 02:50 AM
Problem with Dlookup JAdkins Access VBA 1 January 11th, 2008 06:52 PM
Dlookup problems jik VB How-To 0 February 15th, 2007 04:27 PM
Dlookup and variables Jaqx Access 3 September 29th, 2006 06:47 AM
Help with DLookup Devilboy13 Access VBA 4 August 30th, 2006 02:48 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.