Results 1 to 5 of 5

Thread: Default Value

  1. #1
    Join Date
    Apr 2003
    Posts
    2

    Unanswered: Default Value

    In my database, I want to set it so in my form, if I enter a zip code, it will automaticly change my town and state field to match the zip code. For example,

    If the zipcode of Everwood was 12345, I want to be able to just enter that and my town and state fields will automaticly say Everwood and CO. I don't want every zip code in the united states, just a couple local zip codes in my area.

    Thanks ahead of time

    Matt Tamburro

  2. #2
    Join Date
    Apr 2003
    Location
    Santa Barbara, CA
    Posts
    67

    Re: Default Value

    Originally posted by mtamburro
    In my database, I want to set it so in my form, if I enter a zip code, it will automaticly change my town and state field to match the zip code. For example,

    If the zipcode of Everwood was 12345, I want to be able to just enter that and my town and state fields will automaticly say Everwood and CO. I don't want every zip code in the united states, just a couple local zip codes in my area.

    Thanks ahead of time

    Matt Tamburro
    There are a number of methods to do this. I will give you one, others may want to give their favorite.

    New Table "ZIPCODES" with the fields
    zip text 5 key
    city text 25
    state text 2

    comobox on your form
    name ZIP
    row source type QUERY/TABLE
    row source is ZIPCODES
    bound column 1
    column count 3
    column width 1,0,0

    sub zip_after update()
    if me!zip = "" then
    me!city = ""
    me!state = ""
    else
    me!city = me!zip.column(1)
    me!state = me!zip.column(2)
    end if
    end sub

    There is a way to add a zip code not on the list to the table in that event.
    Ask if you need that.

  3. #3
    Join Date
    Apr 2003
    Posts
    2
    Let me clarify something

    I have very limited experience in access with expressions. The most I have ever done is making columns add together. In the same respect, however, I am certianly not a stranger to access.

  4. #4
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    In the US there can be many cities within a given zipcode though. Unless you are just going to assign a city with a given zipcode.

    such as

    Zip City
    12345 Everwood
    23456 Neverwood
    34567 AlwaysHaveWood

  5. #5
    Join Date
    Apr 2003
    Location
    Santa Barbara, CA
    Posts
    67
    Originally posted by mtamburro
    Let me clarify something

    I have very limited experience in access with expressions. The most I have ever done is making columns add together. In the same respect, however, I am certianly not a stranger to access.
    What part are you troubled by?

    The first section is the table fields for a new table ZIPCODE

    The second section are the relavent properties for the combobox ZIP

    The third section is the Event code for an update to the comboBox Zip.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •