Auto Populate a field in a form

  • Thread starter Thread starter Antony Elson
  • Start date Start date
A

Antony Elson

I have a form that is associated with a table, there is a
field in the table called ToCode (this is a service code,
i.e. 0548), this field is a combo box looking a table
that hold a list of these codes with a description (i.e.
0548 Financial & Technical Systems Support Unit.).

What happens is when I select a new entry and use the
ToCode combo box, this pulls up a list of codes with
there name and uses the first row (Code) and add it to
the associated table.

I want the description to auto add to the table using the
selected code from the combo box.

Does anybody know how this can be done within the form?
 
The *stored* field is determined by the Bound Column
property of the combo box.

I can't understand, though, why you'd want to waste the
storage space. You can always get the description from a
query joining your table to the ToCode table via the
foreign key for printing, displaying on a form, etc.

BTW, please do not multi-post.

HTH
Kevin Sprinkel
 
Sorry for multiple postings, the form was not telling me
it had posted them.

Thanks for your response.

Here is what I am trying to do. There are two fields on a
form; Field 1 is a combo box with a list of codes in col
1, and a description for the code in col 2. Field 2 is a
description.

When on the form and selecting a code from the combo box
(Field 1), I would like the see the description
automatically appear in the Description (Field 2) from
col 2 in the combo box.
 
It's important to distinguish between a field and a
control. Tables have Fields. Forms have Controls--
textboxes, combo boxes, checkboxes, etc., that can be
Bound or Unbound. Unbound controls just display data. If
Bound, then the data entered into the control is stored in
the field to which it is bound.

To display both your code and its description, it's
neither necessary nor desirable to store the Description
redundantly; store only the Code.

Set the unbound Description control's Control Source
property using the Column property of the combo box. It
is zero-based: the first column is referred to by '0',
the second '1', etc.

Assuming the Description is the second column listed in
your combo box' Row Source, set the Description to:

= Me!YourComboBoxName.Column(1)

HTH
Kevin Sprinkel
 
Back
Top