Automatically putting address in a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In access how do you do this. From a pull down menu in your form you select
the business you want. How do you automatically get the address of that
business to display on the form with out typing the address in.

Thanks,
 
Your combobox'x rowsource needs to contain the address fields. Should be:
BusinessID
BusinessName
BusinessStreetAddress
BusinessCity
BusinessState
BusinessZipCode

Put the following code in the AfterUpdate event of the combobox:

Me!StreetAddress = Me!NameOfCombobox.Column(2)
Me!City = Me!NameOfCombobox.Column(3)
Me!State = Me!NameOfCombobox.Column(4)
Me!Zipcode = Me!NameOfCombobox.Column(5)
 
K said:
In access how do you do this. From a pull down menu in your form you select
the business you want. How do you automatically get the address of that
business to display on the form with out typing the address in.


Assuming the address (only one per customer?) is in the
customer table, set the combo box's RwoSource query to
include the address fields. Then you can set each of the
address text boxes to use an expression like:
=combobox.Column(N)
 
So you do this in the design form. So in each combo box you type the code in
each field or do you type the code only in the Company field for this to work.

Example:

134 James Street!StreetAddress = Sam!BusinessName.Column(2)
21 Jim Street!StreetAddress = Ken!BusinessName.Column(2)
VA!State = Sam!BusinessState.Column(4)
NC!State = Ken!BusinessState.Column (4) and so forth

So this will allow when you type the customer's name their street, city, and
zip code for that business will automatically come up and you type another
customers name their street, city, and zip code will automatically come up.

Thanks Very Much,
K

:
 
In access how do you do this. From a pull down menu in your form
The combobox shows only the business name but stores the business ID in your
table.
Build a query between your table and the table that contains the business
address, phone, etc.
User that query in all your forms and reports.
The business ID from the "other table" is added to the form and the address
etc is from the business table.

This is the proper way to do it in a relational database. It requires no
code.
There are samples in the Northwind database.
 
Back
Top