By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,663 Members | 1,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,663 IT Pros & Developers. It's quick & easy.

Automatic form inputs

P: 1
I'm new to access and i need some help. I am using a form to input basic demographic information on clients. I want the form to automatically fill in a bound field based on another field. For example i want to input a city and the form to automatically fill in the county and region. These counties and regions could be based on autonumbers from other tables. So when i put in the city it fills in the county which corresponds to a number.
May 21 '07 #1
Share this Question
Share on Google+
1 Reply

ADezii
Expert 5K+
P: 8,750
I'm new to access and i need some help. I am using a form to input basic demographic information on clients. I want the form to automatically fill in a bound field based on another field. For example i want to input a city and the form to automatically fill in the county and region. These counties and regions could be based on autonumbers from other tables. So when i put in the city it fills in the county which corresponds to a number.
  1. Create a Table named tblLocation with the following Fields:
    Expand|Select|Wrap|Line Numbers
    1. CityID [AutoNumber](Primary Key)
    2. City (TEXT)
    3. County (TEXT)
    4. Region (TEXT)
  2. Create a CityID (LONG) Field in your Primary Table. Create a Relationship between tblLocation and your Primary Table on CityID in the following manner:
    Expand|Select|Wrap|Line Numbers
    1. tblLocation.CityID(1) ==> Primary Table.CityID(MANY).
  3. Create a Combo Box on your Form consisting of the 4 Fields in tblLocation. Display only the City Column, hide the other 3, and Bind CityID to the CityID Field in your Primary Table.
  4. You do not need to store the County and Region values in your Primary Table, since they can be derived from the Relationship to tbLocation on CityID.
  5. If you wish to display the County and Region, create 2 Unbound Text Boxes on your Form and call them txtCounty and txtRegion.
  6. Place the following code in the AfterUpdate() Event of cboCity:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub cboCity_AfterUpdate()
    2.   Me![txtCounty] = Me![cboCity].Column(2)
    3.   Me![txtRegion] = Me![cboCity].Column(3)
    4. End Sub
  7. All the Moderators and Experts are extremely busy at the moment but if you need further assiatance, please let us know and we'll try to get back to you in a timely fashion.
May 22 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.