home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / FERRAMEN / ZIP_CODE / PCCNOTES.TXT < prev    next >
Encoding:
Text File  |  1993-08-25  |  2.5 KB  |  60 lines

  1. PC/Contact Notes and PCX Files.
  2.  
  3. Import the dBASE file, found in ZIPCODDB.ZIP, into Access and 
  4. follow these steps. As an added bonus, the graphics from the 
  5. Step by Step: Microsoft Access are included.
  6.  
  7.  
  8. Reduce mistakes and speed up data entry with forms that 
  9. automatically fill in fields with the correct city and state 
  10. after you enter a ZIP code.
  11.  
  12. Step 1.  Create a Database and Table (See STEPDB1.PCX)
  13. Create a database and a new table with the Field Names filled 
  14. in as shown.  Save the table and make a note of its name.
  15.  
  16. Step 2.  Add an Access Basic Function (See STEPDB2.PCX)
  17. Click on the Module icon and then the New button to add an Access 
  18. Basic function to the database.  Type in the following lines of 
  19. code:
  20.  
  21. ===================================================================
  22.   (Note: the Forums! lines below are wrapped to fit the page. 
  23.   Remove the hard return before "[Zip] to restore the lines to
  24.   the proper format.)
  25. ===================================================================
  26.  
  27. Function GetData ()
  28.     Forms!Form1.City = DFirst("[City]", "Table1", 
  29.     "[Zip] = Forms!Form1.Zip")
  30.     Forms!Form1.State = DFirst("[State]", "Table1", 
  31.     "[Zip] = Forms!Form1.Zip")
  32. GetData = Zip
  33.  
  34. Table1 is the name you gave your table in Step 1, Form1 is the 
  35. name of the form you'll create in Step 3, and the field names 
  36. in brackets are Table1's fields.  (Note:  If you have a table 
  37. of Zip codes and their cities already entered, substitute its 
  38. name and fields in the code.)  Access automatically adds the 
  39. line End Function to the code.  Save your Module by selecting 
  40. File, Save, and then close the module.
  41.  
  42. Step 3.  Create a Form (See STEPDB3.PCX)
  43. Click on the Form icon and the New button to create a form.  
  44. Choose Select a Table/Query, then select your table's name, 
  45. click on Form Wizards, and follow Wizards' prompts.  Give your 
  46. table a title and click on the Design button.  Save the form, 
  47. giving it the same name you used in Step 2.
  48.  
  49. Step 4.  Automate the Form (See STEPDB4.PCX)
  50. Highlight the Zip code field and select View, Properties to open 
  51. the field's properties box.  Type "=GetData()" in the AfterUpdate 
  52. property field.  Close the property box and save the changes to 
  53. the form with File, Save.
  54.  
  55.     During data entry, if your table already contains a Zip 
  56. code you type in, the program automatically completes the City 
  57. and State fields with the correct values.  If you're using a 
  58. separate Zip code database for your lookup table, you'll never 
  59. misspell a city or state again.
  60.