This ZIP Code file was put together for use in database 
applications.  It can be used to automatically look up a 
city and state when a valid ZIP Code is entered and insert 
them into the proper fields to increase both speed and 
accuracy of data entry.

These files are current through March of 1992.  If you would 
like the 1993 ZIP Code file (or the most current file) you 
will need to purchase the updated files.  See the ORDER.FRM 
file for more information.  

There are two examples included which explain how this sort 
of a lookup might be accomplished.  The first example is a 
simple program for use with dBase III and dBase IV.  It can 
also be compiled using Clipper.

The second example gives instructions for setting up a similar 
lookup using Microsoft Access.

You should have the following files:

 ZIPCODES.DBF        Zipcode Database File in dBase format
 DEMO.PRG            Demo dBase program to demonstrate lookups
 DEMO.DBF            Required for DEMO.PRG
 README.TXT          This File
 ORDER.FRM           Form to order updated ZIP Code Files

The ZIP Code file is updated annually.  Updates can be purchased 
for $18.00 each.  See the ORDER.FRM file for more information on 
purchasing updated files.



DBASE III or DBASE IV DEMO PROGRAM

To try the dBase demo program, first load dBase.  At the dot 
prompt type do DEMO.  The first time that you run this program 
you will be asked if you want to create an index file.  This 
index file is required to perform the lookups.  Just press 
enter when you are asked this and then wait for a few minutes 
while the index is built.

Next, a data entry screen will appear and you can enter a 
sample record or two.  When you enter a valid ZIP Code, the 
city and state will be looked up and inserted into the city 
and state fields.




Microsoft ACCESS Example

The following example explains how to set up an automatic 
lookup with Microsoft Access.  I would have preferred to 
distribute the database already set up and ready to go, but 
the size of the resulting file made this impractical.

After loading Microsoft Access select NEW DATABASE from the 
FILE MENU.  Name the new database ZIPCODES.MDB and choose OK.

Next select IMPORT from the FILE MENU.  For the database type 
choose dBase III.  Select ZIPCODES.DBF for the file to import 
and press the IMPORT button.  It will take a few minutes to 
import the file.  When the import is complete you should see 
a message telling you that the import was successful. Close the 
IMPORT window.

Press the DESIGN button to change the design of the ZIPCODES 
table.  Highlight the ZIPCODE Field by pressing the grayed area 
directly to the left of the ZIPCODE field.  Press the KEY icon 
to make the ZIPCODE field the primary key.  A picture of a key 
should appear next to the ZIPCODE field name. Select SAVE from 
the FILE MENU to save the changes you made and wait a few minutes 
for the index to be created.  Now close the DESIGN window.

Now press the NEW button to create a new table.  Enter the 
following fields into this table:
        
        Field Name    Data Type      Field Size
        
        First Name      Text         30 characters
        Last Name       Text         30 characters
        Address         Text         30 characters
        Zip Code        Text          5 characters
        City            Text         30 characters
        State           Text          2 characters
        Phone           Text         10 characters

Select SAVE from the FILE MENU and name the table DATA ENTRY.  
When you are asked for a primary key just select NO.  Close the 
NEW TABLE window.

Select RELATIONSHIPS from the EDIT MENU.  Make the ZIPCODES 
table the primary table and DATA ENTRY the related table.  The 
type of the relationship should be set to many.

In the SELECT MATCHING FIELDS combo box select ZIP CODE then 
press the ADD button then CLOSE the window.

Next select QUERY from the Database window and select NEW to 
create a new query.  Add both the DATA ENTRY table and the 
ZIPCODES table.  Next double click on the following fields 
from the DATA ENTRY table to add them to the query grid:

        First Name
        Last Name
        Address
        Zip Code

From the ZIPCODES table double click on the City and State 
fields.

From the DATA ENTRY table double click on the Phone field.

Save the query with the name LOOKUP QUERY and close the query 
window.

Now press the FORM button from the DATABASE WINDOW and then 
press the NEW button to create a new form.  Select LOOKUP 
QUERY as the query to build the FORM from then press the 
FORM WIZARDS button.

Choose the SINGLE-COLUMN Wizard.  When you are asked which 
fields you want to add to your form press the >> button to 
move all fields into the new form and then press the NEXT 
button.  Next click on EMBOSSED and then NEXT.

Now press the OPEN button to open the form.  Save the form 
with the name LOOKUP FORM.

Try adding a couple of records.  When you get to the ZIP CODE 
field try punching in your own ZIP Code and let ACCESS look up 
the city and state for you.

If you wish, you can prevent editing in the City and State 
fields and skip over them entirely by changing the ENABLED 
property of the City and State controls in the LOOKUP FORM to NO.


HELP Software
PO BOX 1423
Raymore, MO 64083
(816) 331-5809
CompuServe 73720,2530
