Access 2007-2016
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  

< Previous: Access Expert 9

Next: Access Expert 11 >

Access Expert Level 10

Expert Microsoft Access Tutorial - 1 Hour, 27 Minutes
This Microsoft Access video tutorial picks up where Expert Level 9 left off. In this class  we will work with quotations, invoices (paid & unpaid), the DLOOKUP function, and calculated table fields. Topics include:
  - Quotation or Invoice
  - Paid or Unpaid
  - Nested IIF Functions
  - The DLOOKUP Function
  - Sales Reps & Service Techs
  - DLOOKUP Criteria (ID, String, Date)
  - Display Values Direct from Tables
  - Calculated Table Fields
  - Expressions in Queries vs Tables

Order Now

If you would like a preview of what's covered in this class,
click here to watch the first and last lessons of this course (free of charge), or scroll down for more information.


Access Expert Level 10
Description: Access Expert Level 10
Versions: Recorded with Access 2013. Also use with 2007 and 2010. The last short lesson on calculated table fields won't work with 2007 because that feature was added in 2010, but you're not missing much as I generally recommend against using them.
Pre-Requisites: Access Expert Level 9 strongly recommended
Running Time: 1 Hour, 27 Minutes
Cost: $24.99

This class picks up where Expert Level 9 left off. We will start by reviewing my solution to the homework assignment you were given in the last class. You were to move the name, address, and company logo of our fictitious company to the System Defaults table we created in Expert 9. This way you can display that information anywhere in the database without having to copy and paste it a million times if it changes. We'll also learn about Nested IIF Functions.


Next, you will learn about one of the most powerful functions in Access: DLOOKUP. You can use DLOOKUP to pull information directly out of a table or query without having to have a form open. We'll create a special form just for our System Defaults (instead of having them always sitting on the Main Menu) and then use DLOOKUP to read that data for our company name, address, and logo on our forms and reports.


We'll spend lots of time learning about DLOOKUP. In the previous example, we were just dealing with a table that only has one record: the System Defaults. However, DLOOKUP's true potential comes when you learn how to send it criteria to pick data from a specific record. We'll learn how to work with numeric (ID) criteria, text string criteria, and even date criteria. You'll learn about the troublesome "double-double quotes" which can make your life miserable if you don't get them right. We will use this technique to look up the phone number for an order's sales rep so that you can quickly display it on the order form and invoice.


We'll discuss how we can have multiple fields that are related to a value in another table, but have different names. For example, we'll have a SalesRepID and a ServiceTechID in the Customer's table (a sales rep and a service tech) but both will be related to the EmployeeT. You'll see how the relationships for this work.


Finally, we'll learn about Calculated Table Fields. These are similar to the Calculated Query Fields we worked with in previous lessons, however the results are stored directly in the table. You generally want to avoid using them, but there is an exception - and we'll talk about that in this lesson.


This is the tenth class in the Access Expert series. There's a lot of great material in this class. Learning DLOOKUP alone will make your databases much more powerful. Of course, if you have any questions about whether or not this class is for you, please contact me.


Complete Outline - Access Expert Level 10

00. Intro (7:02)

01. Quote or Invoice (28:09)
Add My Company Info to Defaults
Company Logo
Size to Tallest
Paid or Unpaid Text on Invoice
Refresh Dirty Record
IsQuotation Field on Order Form
Quotation or Invoice Text
Nested IIF Functions
Hide Paid Text if Quotation

02. DLOOKUP Function (12:10)
Move System Defaults to Own Form
DLOOKUP Field, Table
Get SalesTaxRate from DefaultT
Edit Invoice to use DLOOKUP
03. More with DLOOKUP (25:35)
Sales Rep for Customer
Related Fields with Different Names
Sales Rep Combo Box
Service Tech Combo Box
SalesRepID on Order Form
Display Sales Rep's Phone Number
Criteria Format
"EmployeeID=" & SalesRepCombo
@@@-@@@-@@@ Phone Number Format
Strings Inside Criteria
Double Double Quotes ""
Dates in Criteria need # signs
AND Condition in Criteria
Add Rep Name and Phone to Invoice

04. Calculated Table Fields (8:31)
Expressions in Tables vs Queries
Problems with Calculated Table Fields
When to use them
Example: TimeToShip in Days

05. Review (5:35)


Keywords: Printable Invoice, microsoft access tutorial, microsoft access tutorial, microsoft access training, access 2007, access 2010, access 2013, quote, quotation, invoice, company logo, paid, unpaid, iif, dlookup, sales tax, criteria, and condition, calculated table fields, calculated values

Student Interaction: Microsoft Access Expert 10

Richard on 7/24/2013:  Microsoft Access Expert Level 10 is 1 hour, 27 minutes long. In this tutorial we will work with quotations, invoices (paid & unpaid), the DLOOKUP function, and calculated table fields. Topics include: - Quotation or Invoice - Paid or Unpaid - Nested IIF Functions - The DLOOKUP Function - Sales Reps & Service Techs - DLOOKUP Criteria (ID, String, Date) - Display Values Direct from Tables - Calculated Table Fields - Expressions in Queries vs Tables Click here for more information on Access Expert Level 10, including a course outline, sample videos, and more. This course was recorded using Access 2013, but is also valid for Access 2007 and 2010 users. This class follows Expert Level 9.
Bruce Reynolds on 8/13/2013: Do you have to put a space between the " after EmployeeID= and before the & and also a space between the & and SalesRepCombo? If you don't put in spaces before and after &, does Access put them in for you?

Reply from Richard Rost:

It depends on the context, but generally Access is pretty forgiving with the spaces. Bottom line: if it ain't workin', put the space there. :)

Bruce Reynolds on 8/13/2013: Perhaps Microsoft or someone should make more use of the ~ character. This could be a good substitute for the ' or the " character. It's at least easier to read. I don't know how many times I've had to bring out a magnifying glass to decipher the plethora of """"""""" quotes in various programming lines of code.

Reply from Richard Rost:

Tell me about it.

Bruce Reynolds on 8/13/2013: Excel has a CONCATENATE function. Does Access have a similar function that can be combined with DLOOKUP?

Reply from Richard Rost:

I'm not sure, but I've never needed it. You can always concatenate with the & character, so it's never been an issue for me. In fact, I almost never use the CONCATENATE function in Excel either (you can use & there too).

Bruce Reynolds on 8/13/2013: Do multiple calculated fields in a table affect performance as the number or records goes up?

Reply from Richard Rost:

I haven't tested it, but I would assume NOT. The calculation is performed when the record is saved or edited, so the total number of records shouldn't be an issue. Access is just working with ONE record at a time.

Bruce Reynolds on 8/13/2013: I can see that adding calculating fields in a table increases performance for many records (> 500,000). What kind of database product has Microsoft produced to compete against Hadoop and other multidimensional databases?

Reply from Richard Rost:

SQL Server Enterprise Edition has many of the same features.

Bruce Reynolds on 8/13/2013: Does MYSQL, Oracle, or Microsoft SQL server have or support calculated table fields?

Reply from Richard Rost:

I can't speak for MySQL or Oracle because I've never used them. SQL Server uses a "computed column" which is closer to a calculated query field, and is NOT stored in the table. SharePoint DOES support calculated table fields.

John Miller on 12/19/2013: Microsoft Expert 10 Time Line 11:02. When setting up the "Reps Phone" using a DLook Function I keep getting an error in the Phone Number box #ERROR Before I click on the Box or the label it blinks rapidly. I have re-watched the entire Video several times. I am unable to get it to work, I loaded up the database 10 from the library and it runs ok. What might be wrong. Here is the info on the SalesRepCombo combo box and the Reps Phone Text Box.
Combo Box Name: SalesRepCombo
Control Source: SalesRepID
RowSource:SELECT [EmployeeT].[EmpolyeeID], [EmployeeT].[FirstName], [EmployeeT].[LastName] FROM EmployeeT ORDER BY [FirstName], [LastName];
Default Vaule: =Forms![CustomerF]![SalesRepCombo]
SalesRepPhone: Text Box
ControlSource: =DLookUp("WorkPhone","EmployeeT","EmployeeID=" & [SalesRepCombo])

David Koehler on 1/25/2014: Form with two combo box fields. Using form and control properties alone, can you set part of the row source of the second combo box to the control source of the first one. In other words, the first combo box gets a value from its row source, then conditions the second combo box to present a list of values specific to that first choice.
SHIVJI PATEL on 3/3/2014: Sales Rep and Service Tag both using same data of Employee Table. Now I need Query based on Customer Table that show Employee name who have engaged with customer either by Sales Rep or by Service Tag. So Employee will get whole chart that he is connected to which of customer. If I make a Query based on Customer Table and add only customer name , Sales Rep and Service Tag and giving employee name in Criteria to Sales Rep or same name to Service Tag with any one of employee name , than it shows error.
SHIVJI PATEL on 3/9/2014: At 18.15 there is Refresh Record and Refresh. What is difference between them ?? BY mistake have used only refresh in new action for button command and it's working fine.
vicki H on 3/23/2014: I have about 7,000 unique ID's with name,address,and lots more info. Is DLookup the best way to get all that info in the fields with just putting in the unique id? BTW I love all of these courses. Thank you for all of us who would rather learn real life than book situations

Reply from Richard Rost:

Yep. Just store the IDs. That's all you need unless you're concerned with storing history.

vicki Hudson on 3/24/2014: I am trying to use Dlookup to lookup up a number (H1234)that belongs to a name(text). I was getting a blinking "Error" then put the dbl dbl quotes and now just get "Error". Not sure what to do here.

Reply from Richard Rost:

Let's see your code... show me the line that's giving you the error.

Garry Smith on 4/2/2014: I am trying to load an unbound text box with the following DLookup function but I get nothing in the text box
Me!txtArtistItemNum = DLookup("ArtistItemNum", "tblConsignments", "GalleryItemNum=" & "txtGetItemNum")

This next statement works fine for a text box that is connected to a table though.
ArtistItemNum = DLookup("ArtistItemNum", "tblConsignments", "GalleryItemNum=" & "txtGetItemNum")
Can you tell me what I m doing wrong?
In both cases txtGetItemNum is an unbound text box that the user types in the search data and then clicks the search button which triggers the procedure the above statements are in.

Reply from Richard Rost:

If your txtGetItemNum is a TEXT value, as the name suggests, then you have to enclose it in quotes in your DLOOKUP statement:

Me!txtArtistItemNum = DLookup("ArtistItemNum", "tblConsignments", "GalleryItemNum=""" & "txtGetItemNum" & """")

Garry Smith on 4/2/2014: I tried your suggestion by copying your statement above but it did not work for me either. Thanks for the quick response though.

Reply from Richard Rost:

I'd really need to see your database to tell you what's wrong, then. You can submit it to me and my Techs here: TECHHELP.

Stephen Eller on 7/24/2014: Rick,

Are there any problems with using Dlookup with a split database?

Thanks, Stephen

Reply from Richard Rost:

Not really, except it could be REAL slow if your table is large.

Brian Farley on 9/15/2014: So for the homework, I put the IIF function for the quote and paid as fields on the report instead of part of the query.

Any Con to doing that, other than you can't get to that field from another report?

Is there a limit on how many fields you can have in a query?


Reply from Richard Rost:

It's been over a year since I recorded that, so I don't remember what the homework was... but just do whatever I said to do in the video. LOL. Ha ha. :)

This is one of those "6 of one way, half-dozen of another" things. There's really no BEST way to do it - whatever works for your situation. Part of me teaching you alternatives is so that you can see what might work best for each scenario.

There is a limit to the number of fields you can have in a query, but realistically you should never hit it.

Raymond Trussell on 9/19/2014: using the dlookup I get the correct info on the screen but it is not in the table for that screen text box. Why is it not in the table as a combobox does is?
Shaun Marple on 12/17/2014: Is there any way to have a series of combo-boxes that filter each other so that there is a limited list in each?

I want to use it for both querying and entering data. However, for querying, I am looking to connect all entries together for the exact query and, I am looking to use a filtering technique to use only the final combo-box for entry purposes.

Do you have any suggestions?

Reply from Alex Hedley:

How about Cascading Combos?
Here is a TIP.

Kenny Nelson on 12/22/2014: I have used DLOOKUP on our SQL tables at work that have thousands of records and it is VERY slow. Is there a way to speed it up, or is there another method that is faster?

Reply from Alex Hedley:

I wouldn't use DLOOKUP on a large recordset it's inefficient as you've seen.
Why not do a join on your tables to get the value you need?

Cindy Sloan on 3/10/2015: In reply to Garry Smith: It's been a year but in case someone else looks at this and wonders themselves, the answer you were given was almost right. You DO need single quotes around the value of txtGetItemNum and you would format it the way Richard showed. But you do NOT need quotes around the control name. Quotes go around text VALUES, not the controls and variables that hold the values. So the last part of the DLookup would look like this: "GalleryItemID= '" & txtGetItemNum & "'")

Reply from Alex Hedley:

Thanks for pointing it out.
(I think it was a typo/copy and paste job)

Richard Wilson on 10/17/2015: I have followed the instructions and gotten DLOOKUP to work! To populate some blanks when a name is filled in, e.g. address, tel number, email etc. BUT is there a way to keep it from showing "error" when the first field (from which it does its looking up) has not been filled in? Once it's filled in, the errors go away.

Reply from Alex Hedley:

How about an NZ()?

Dennis Owens on 2/20/2016: In Access Expert 10 when you set up the paid or unpaid and the quotation or invoice. on the printout of the quotation you don't want paid or unpaid to show up on the report. You also have it set up as an invoice so when you check the box it chages it to a quotation. How do you write it out in the querie if when you check the box you want it to be an invoice?

Reply from Alex Hedley:

You could just copy the principle and show those words instead

Ronda Ficklin on 6/2/2016: You showed this, but didn't mention it.
When you link EmployeeID to SalesRepID, that is the first time these fields are linked together. ***When you link EmployeeID and ServiceTechID, it states you already have a relationship, you clicked NO and Access added a second Employee Table to this view and linked the fields. ***

Shontovia Clayton-Neil on 6/6/2016: I'm building a work order (service) database. Each account has an account number, and are assigned Project Numbers, the account number never changes but the work order number and Project number do. What is the best way to make sure that the account number is always associated with the specific account? Would the Account Number be the primary key? I know that it's a primitive question but I am unsure about it.

Reply from Alex Hedley:

Make it an AutoNumber, this will auto increment and not change,


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


Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP