Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
 
Home   Courses   Seminars   Templates   Help   TechHelp   Forums   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > DLookup < QQ4 | Quote, Invoice, Receipt >
 
DLookup
By Richard Rost   Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   5 months ago

Use DLookup to Look Up a Value from a Table


 S  M  L  XL  FS  Join Now

In this video, I'll show you how to use the DLookup function to look up a value from a table or query. We will look up a sales rep's phone number based on his ID.

Mitchell from Akron, Ohio (a Gold Member) asks: Each of my customers have an assigned sales rep. I've got the rep's name displayed in a combo box on the customer form. Is there a way that I could have his phone number appear next to it so I don't have to keep clicking and loading different forms? I tried making the phone number the second column in the sales rep combo box, but people still have to click to open it up to see it, and sometimes people accidentally change the rep. I just want the phone number to appear next to his name in a text box.

Common Formats

  • DLookup("Field", "Domain", "Criteria")
  • DLookup("FirstName", "CustomerT", "CustomerID=5")
  • DLookup("FirstName", "CustomerT", "CustomerID=" & CustomerCombo)
  • DLookup("StateName", "StateT", "StateAbbreviation=""" & State & """")
  • DLookup("OrderID", "OrderT", "OrderDate=#" & LastOrderDate & "#")
  • DLookup("CustomerID", "CustomerT", "FirstName=""" & FN & """ AND LastName=""" & LN & """")

Members

Members will learn how to handle DLookup criteria involving text strings and dates and use NZ to deal with NULL values. We will learn about AND/OR conditions in criteria. We will see how to use DLookup with DMax and DSum to get the date and amount of a customer's most recent order.

Silver Members and up get access to an Extended Cut of this video. Gold Members can download the database template from class plus get access to the Code Vault. If you signed up on YouTube you have to contact me so I can set up your account here on my web site. If you're not a member, Join Today!

Links

Learn More

FREE Access Beginner Level 1
Access Level 2 for $1.00

Free Templates

TechHelp Free Templates
Blank Template
Contact Management
Order Entry & Invoicing
More Access Templates

Resources

Mailing List - Get Emails When New Videos Released!
Consulting - Need Help with Your Database?

Questions?

Please feel free to post your questions or comments below or submit them via the TechHelp page.

Keywords

microsoft access, ms access, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #instruction, #learn, #lesson, #training, #database, dlookup, dlookup function, dsum, dmax, return a value, look up a value, lookup value, criteria, what is dlookup, argument, getting a value from a table or query, dlookup multiple criteria, dlookup multiple values, dlookup criteria from another table, dlookup query, dlookup error, dlookup with string criteria, dlookup with date

 

DLookup Upload Images   Link 
Chris Nichol 
30 days ago
Hi all,

Can you create a Dlookup based on the different criteria's? So for example I have a flange register, on that register there is a field for torque value. Now this value can change if the bolt size is different, if the gasket is different or if the bolt material is different. Each one of these has a separate field also. Is there a way of doing a dlookup so if the flange is a 1" 150# with B8 bolts that are 1/2" and the gasket is spiral wound the torque figure = 100lbft Read More...
Alex Hedley
30 days ago
Did you try the Common Formats from above?
DLookup("CustomerID", "CustomerT", "FirstName=""" & FN & """ AND LastName=""" & LN & """")
Scott Axton
30 days ago
Yes it is possible. However,  You can only look up what you already have in the table or query you are looking up from.

Check out  Value from a Form
also look into the Search Seminar

I see that you have started the Beginner Series and some of this is pretty complicated if you don't have a good base to work from.
Keep following the courses in order to make sure you develop that base.
Add a Reply
DB Upload Images   Link 
Horace Martin 
2 months ago
HOW DO I MAKE ONE SELECTION AND POPULATE MUITI FIELDS.
FOR EXAMPLE, I SELECT  NAME.  DOB, POB, CITY, PHONE FIELDS ARE AUTOMATICALLY POPULATED.
Alex Hedley
2 months ago
You could use DLookup in combination with an AfterUpdate
Richard Rost
2 months ago
What Alex said. And stop shouting. :)
Add a Reply
Columns in Combo box Upload Images   Link 
Scott Axton 
5 months ago
Richard -
I'm trying to wrap my head around using the columns in a combo box.  Just finished watching this video and also Developer 15 where you use .Column(0,x) in an example in lesson 3. Read More...
Richard Rost
5 months ago
Yes, Scott, you could absolutely use the second column from the combo box, however the point was to show DLookup. In THIS case it would work, but you can't load certain values into a combo box (like Long Text) and you may want to DLookup more values than you would normally put into the combo box, or even not know which field you want to look up until runtime. Hence, DLookup.

.Column(0,x) is just another way of saying Column Y, Row X. It's used for List Boxes.
Add a Reply

Show Older Comments...
View in Table Format

Start a NEW Conversation
 
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.
 
Subscribe
 

You may want to read these articles from the 599CD News:

10/17/2021Date Only?
10/16/2021Relink Tables
10/16/2021Access Developer 34
10/16/2021Access Developer 34 Lessons
10/16/2021Access Developer 34
10/10/2021Copy Text from Field
10/10/2021Access for Free
10/9/2021Birthdays
10/8/2021Label Resize
10/2/2021Criticisms of Access
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Blog RSS Feed    Twitter

YouTube Channel    LinkedIn
Keywords: TechHelp Access dlookup function dsum dmax return a value look up a value lookup value criteria, what is dlookup argument getting a value from a table or query dlookup multiple criteria dlookup multiple values dlookup query dlookup error dlookup string  PermaLink