Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Feb 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Autofilling a Field based on a second Field

    Hi,

    I am trying to set up a database that records peoples travel history.
    On the database I want to be able to record the country the person went to.
    Based on the country selected I would then like a separate field on the table to autofill with the relevant region of the world. (And preferably for that field to be on the table but not actually visible on the form that is being used for data entry)

    So for example if I set Country of world to "Mexico" it would automatically fill in region as "Central America" or if you select "Ivory Coast" for it to automatically fill in region as "East Africa"

    The reason for doing it this way is to ensure that the appropriate region consistently gets linked to the correct countries.

    Filling in the country bit seems pretty easy using a lookup wizard but I can't workout how to get Field B to automatically complete itself based on Field A.

    Any suggestions/explanations gratefully accepted,

    Michael

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Michael,

    Use the AfterUpdate Event on the Country field. Of course, you'll have to write some VBA code to do the lookup and set the value for the Region field.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    Why not set up a table of Country and Regions, then use that as a lookup in other forms to get the region based upon the country.

Posting Permissions

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