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 > AfterUpdate < Turn Off Warnings | NZ >
By Richard Rost   Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   16 months ago

AfterUpdate Event & DLookup - Look up Values from Table to a Form

 S  M  L  XL  FS  Join Now

In this Microsoft Access tutorial, I will show you how to look up and auto populate fields in a form using the DLookup function and the AfterUpdate event in VBA (Visual Basic). Don't worry if you've never done any programming before. I'll take it step by step.

Chris (Gold Member) asks, "I assign zone numbers to customers based on the state the customer is in. However, this isn’t a rule. There may be exceptions, such as if a sales rep brings in a new customer from out of his zone. Is there a way to automatically fill in the default zone for the customer when I enter his state, but still be able to change it?"


I'll show you how to prompt the user for the Zone number if the State isn't found in the table. We will learn how to use the InputBox, NZ, CInt, and IsNumber functions, and learn about type casting.

Silver Members and up get access to view Extended Cut videos, when available. 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!

Learn More

AfterUpdate events are taught in detail in my Access Developer 1 class.


AfterUpdate Events:
DLookup Function:
String Concatenation:
InputBox Function:
NZ Function:
Type Casting:
CInt Function:
IsNumeric Function:
SQL Seminar:

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


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


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


Passing a string to the parent Upload Images   Link  
Despina Karayanni 
9 months ago
I'd very much appreciate if you could advise about how may I transfer a string to the parent field, instead of the numeric value. I've tried very much, however I cannot succeed to any results. Best, Despina
Richard Rost
9 months ago
I'm sorry, but I don't understand what you mean by transferring a string to the parent field. Are you trying to use a string value as the criteria?
Despina Karayanni
9 months ago
I use the code of update and dlookup ( I fill in the Address in OrderF and I want to update the Address of the CustomerT (a string field).
Furthermore, the variable that I have, in the place of 'State', in your example, is a Combo, the 'Combo22'.
So, I have unsuccessfully adopted your code. Do you have listed a specific lesson, or something relevant, for updating fields that are string, and not numeric?
Thank you very much.
Add a Reply
AfterUpdate Brain Wrecking Upload Images   Link  
Pete Santiago 
10 months ago
I'm working on a Pop Reminder for User to input number  of [DaysToCall] to followup from a [XDateToCall].

AfterUpdate works great with this:
Private Sub DaysToCall_AfterUpdate()
Richard Rost
10 months ago
How about:

Private Sub DaysToCall_AfterUpdate()
    If IsNull(DaysToCall) then DaysToCall = 1
    XDateToCall = Date + DaysToCall
End Sub

Remember, you don't need to use DateAdd for days. Just add whole numbers. Save DateAdd for weird stuff like months or years.
Pete Santiago
10 months ago
It worked of course!!!  Thank you so much!  I should have stepped away hours ago...UGH!...Thank you again for what you do!
Add a Reply

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.

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

11/30/2021Import Multiline Cells
11/30/2021Adam's Access Games
11/29/2021Prevent Close
11/22/2021Currency Symbols
11/13/2021Access Developer 36
11/13/2021Access Developer 36 Lessons
11/13/2021Access Developer 36
11/13/2021Control Tip Text
11/11/2021Link to Excel

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

YouTube Channel    LinkedIn
Keywords: TechHelp Access afterupdate dlookup   PermaLink