Solved

How populate state after entering a zip code

Posted on 2014-03-19
1
226 Views
Last Modified: 2014-03-19
I have a zipcode table setup which contains just the 5 digit zip code.  But we are going to enter the Zip +4 in a field.  For the afterupdate event of the zip code field I have this:

   txtState = DLookup("State", "tblZipCodeDirectory", "ZipCode = " & Me.txtZipCode)

But we're entering the zip +4 data in the first field.  How do I ignore the +4 part of it to do the DLookup?

--Steve
0
Comment
Question by:SteveL13
1 Comment
 
LVL 9

Accepted Solution

by:
dustock earned 500 total points
Comment Utility
Try the left function to only take the first 5 characters

Left(Me.txtZipCode,5)
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now