home *** CD-ROM | disk | FTP | other *** search
- PC/Contact Notes and PCX Files.
-
- Import the dBASE file, found in ZIPCODDB.ZIP, into Access and
- follow these steps. As an added bonus, the graphics from the
- Step by Step: Microsoft Access are included.
-
-
- Reduce mistakes and speed up data entry with forms that
- automatically fill in fields with the correct city and state
- after you enter a ZIP code.
-
- Step 1. Create a Database and Table (See STEPDB1.PCX)
- Create a database and a new table with the Field Names filled
- in as shown. Save the table and make a note of its name.
-
- Step 2. Add an Access Basic Function (See STEPDB2.PCX)
- Click on the Module icon and then the New button to add an Access
- Basic function to the database. Type in the following lines of
- code:
-
- ===================================================================
- (Note: the Forums! lines below are wrapped to fit the page.
- Remove the hard return before "[Zip] to restore the lines to
- the proper format.)
- ===================================================================
-
- Function GetData ()
- Forms!Form1.City = DFirst("[City]", "Table1",
- "[Zip] = Forms!Form1.Zip")
- Forms!Form1.State = DFirst("[State]", "Table1",
- "[Zip] = Forms!Form1.Zip")
- GetData = Zip
-
- Table1 is the name you gave your table in Step 1, Form1 is the
- name of the form you'll create in Step 3, and the field names
- in brackets are Table1's fields. (Note: If you have a table
- of Zip codes and their cities already entered, substitute its
- name and fields in the code.) Access automatically adds the
- line End Function to the code. Save your Module by selecting
- File, Save, and then close the module.
-
- Step 3. Create a Form (See STEPDB3.PCX)
- Click on the Form icon and the New button to create a form.
- Choose Select a Table/Query, then select your table's name,
- click on Form Wizards, and follow Wizards' prompts. Give your
- table a title and click on the Design button. Save the form,
- giving it the same name you used in Step 2.
-
- Step 4. Automate the Form (See STEPDB4.PCX)
- Highlight the Zip code field and select View, Properties to open
- the field's properties box. Type "=GetData()" in the AfterUpdate
- property field. Close the property box and save the changes to
- the form with File, Save.
-
- During data entry, if your table already contains a Zip
- code you type in, the program automatically completes the City
- and State fields with the correct values. If you're using a
- separate Zip code database for your lookup table, you'll never
- misspell a city or state again.