Combo Box question

  • Thread starter Thread starter Bill B.
  • Start date Start date
B

Bill B.

I posted this message last week and haven't gotten any
reply, so I thought I'd try again because this is a
question I HAVE to have answered this week.

I am trying to automate data entry with a form. I have two
tables. The combo box is drawing from one of the tables,
which has two fields. When I use the drop-down box, it
shows both fields, but will only display one of the fields
in the form. I want the data entry person to pick the
first field, and have both fields appear in the form.
However, I can't seem to specify how to make the second
field appear on the form. For example, the drop-down box
shows:
A-3 General Reference
A-4 Specific Topic #1
A-5 Specific Topic #2
etc., but when I chose one of the topics, all that appears
on the form is:
A-3
A-4
A-5

I want both fields to appear on the form. I know that this
can be done because I've seen it before, but I just can't
figure out how to make it work. Any help you can provide
would be much appreciated.

Thank you,

Bill B.
 
The combo-box will only show the value of the first visible
column in 'textbox' after an entry has been selected. To
achieve what you are after, try something along the
following lines

1. Change the RowSource SQL to something like
SELECT < your column1> & " " & <your column2> as Concat,
<your column1>, <your column2> FROM <your table>

2. Change the BoundColumn to whichever of your 2 columns
you wish to use.

3. Change the ColumnCount to 3

4. Change the column widths so that the first column is now
very small e.g. 0.002cm

Hopefully, that will achieve the result that you are after.

Hope That Helps
Gerald Stanley MCSD
 
Create another text box (Text2) for the second field
in the afterupdate event of your combobox put

Me.Text2 = YourComboBox.Column(2)
 
I don't think my knowledge of Access is good enough to
follow any of the three sets of instructions given here.
What I got when I tried to follow the directions is a new
combo box that does nothing when I select a value from the
first combo box--it remains empty. There is a drop-down
menu for the second combo box that either displays just
the key field from the original table or query, or
nothing. When I try to select anything (although I
shouldn't have to select anything), it tells me
that "Control Can't be edited. It's bound to the
expression 'cboID.Column(2)'". This was the BEST I came up
with. It did not matter what column I chose (1, 2 or 3),
it always displayed the key field or nothing. The other
two solutions resulted in an empty text box that did
absolutely nothing. It's frustrating that I'm convinced
that this can be done, but the problem is with my lack of
knowledge, lack of time (I have to get something completed
by the end of the day today), and is not with the program
itself. What I plan on doing is using two list boxes
instead and have the data entry people chose two different
values instead of just one. It's awkward and clunky, I
HATE it, but it's the only thing I'm able to do given my
knowledge of Access (which I formerly thought was decent).
I will post this again someday when I can read the
directions and understand what they mean.

Bill B.
 
I had understood your first post to be asking for showing the "second" value
in a textbox. However, if you want to have it in a combo box, then this web
site shows how to tie two combo boxes together (the second one being
filtered by the choice made in the first):

http://www.mvps.org/access/forms/frm0028.htm

In the original URL that I'd posted, there are only two examples for how to
display the second value in a textbox. If you use the example for a Unbound
Textbox, then no you won't be able to change the value in the textbox
because that value is set by the expression. Note that the website is using
generic names for the combo box and textbox; you need to replace those names
with the actual names of your controls.

If you can provide the specific names of table(s), field(s), and control(s),
and which values you want to display in the combo box and textbox, we should
be able to help you through this setup.
 
Back
Top