da************@verizon.net (David Savageau) wrote in message news:<b2**************************@posting.google. com>...
Can anyone help with the following problem? The solution will likely
be elementary to many members of this newsgroup, but, Duh! I've been
struggling to find it all day.
On an Access 2000 form I'm designing, there is a combo-box for the
names of 535 Members of Congress. The Recordsource is a table. The
Autoexpand property is on. When I enter the first few letters of the
last name, the field fills beautifully.
My problem: How can I include additional information - such as phone
number and congressional district - from the underlying table either
in the combo box or as separate fields on the form? I've spent hours
with reference books on this. Any ideas?
There have been recent posts about this very topic. You need to
choose whether to use bound or unbound controls on the form. Since it
seems you only need to view the information there's not much
difference in the effort required to do either. For unbound, open a
recordset with a SQL string that finds the congressperson listed in
the combobox and assign the values to the unbound textboxes on the
form. A good place to put this code is in the AfterUpdate Event of
the combobox. The assignment looks something like txtDistrict.Value =
MyRS("District"). Most people in this NG would use a combobox with
two fields (columncount = 2) having the second field as the bound
column and the Primary Key of tblCongressMembers as the first field.
The ColumnWidths would look something like 0";3.5" to hide the Primary
Key. Then the SQL string could use the combobox.Column(0) value to
look up the correct congressperson using the Primary Key. Many people
in this NG prefer the bound approach. It does have some advantages,
particularly of binding people to Microsoft :-). Seriously, binding
the values using the RecordSource of the form can often be implemented
using less code but the more the tables get bound to forms the more
likely it is that you will run into conflicts when updating values.
Access is fully capable of handling both techniques. I'll let a
stronger proponent of bound controls explain their position if you
don't find what you need from recent posts.
James A. Fortune
I pay my employees just enough so they don't quit. The problem
is they do just enough so they don't get fired.
--- Tire Store Manager