Updating fields in forms

  • Thread starter Thread starter Chris Holder
  • Start date Start date
C

Chris Holder

How do I automatically update the corresponding fields in
a form when a field has been chosen eg: select name of
company and all company details automatically appear in
the correspoding fields when entering new information eg
new invoice.
 
Assuming you are selecting the company name from a
dropdown list, you can do the following:
- change the query that selects the company name to also
select all other info needed, i.e., address, phone, etc.
- you do not need to display those "extra" columns in your
dropdown and can manage that from the dropdown properties
list; also, make sure you are still binding to the correct
column;
- in the AfterUpdate event for your company name field,
add code similar to this:
Me.CompanyAddressFieldName.Value = Me!
CompanyNameField.Column(1)
Me.CompanyPhoneFieldName.Value = Me!CompanyNameField.Column
(2) [the Column property is zero-based so your first
column = 0, second = 1, ...]
etc.
Hope this helps.
 
How do I automatically update the corresponding fields in
a form when a field has been chosen eg: select name of
company and all company details automatically appear in
the correspoding fields when entering new information eg
new invoice.

If you're trying to *copy* the company details from the Company table
into another table... DON'T. There is no need or benefit from storing
the information redundantly! Just store the CompanyID.

You can *display* the information by including all the fields that you
want to display in the Rowsource query of the Combo Box you use to
select the CompanyID. The other textboxes would have control source
properties like

=cboCompanyID.Column(n)

where (n) is the zero based subscript of the field you want shown.
 
Back
Top