-----Original Message-----
I have a table with over 40,000 records in it. The
fields i'm trying to get working
are "Code", "Description", and "Category" relating to the
code. I'm creating a form with these fields along with
others in the same table but want to be able to select a
particular code (i.e. 101) and have the Description and
Category fields automatically update with the correct
corresponding data to that code. I also have a table
that only list the codes, description, and category.
Please help. Thanks in advance.
First off you should realize that what you are doing is incorrect in terms
of database design. The Description and Category data are already stored
once in your lookup table and that is the only place they should be stored.
Your second table should store ONLY the Code value and then you use a
query, subform, Dlookup(), ComboBox, or a myriad of other lookup techniques
to *display* the Description and Category any place you want to see them.
Don't make redundant copies of the data that run the risk of getting out of
synch should any of the values ever need to be updated.
What I would recommend with only two other fields involved is to have the
Code:
field on your form be represented with a ComboBox using your lookup
table as its RowSource. Have all three columns of data in the CombBox
RowSource, but have Category and Description columns hidden by setting
their width to zero.
On your form along with the ComboBox you have two *unbound* TextBoxes with
ControlSource properties of...
Me.ComboBoxName.Column(1)
and
Me.ComboBoxName.Column(2)
....respectively. This will cause those two TextBoxes to display the
appropriate values for Category and Description depending on the Code value
selected in the ComboBox. It will look and act exactly the same as you
want, but without making redundant copies of the other two fields. Those
fields would then be removed entirely from your second table as they are
not needed.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
.
[/QUOTE]