how can I populate a field with a combo box with duplicate values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My combo box looks up a row from a table. The fields are "Output Type" and
"Adjustment". The problem is the adjustment values are the same for more
than one output type so that if the output type I am trying to select
contains a value that occurs earlier in the list, it returns that row's
output type, but the correct value is entered in the adjustment field. I
have been working on this for 3 days. Please help, anyone!

Thanks
 
I sounds like you are trying to select two types of criteria from the same
ComboBox. You can do that if you use a third field so the combination of the
two criteria use a unique number/character set in the third field.

You should use a separate ComboBox for each selection criteria.
 
walkbyfaith7,
You'll need to add a key field to the underlying table upon which your combo is based.
AdjustmentType is not discreet or unique enough to define which OutputType you are
selecting.
Each record should have it's own unique identifier value, and the combo should select
by that value, not by the dupe fields.
 
Thanks Karl. I added a field to my table called "Index" and made it the
primary key, but the Combo box works the same. It appears to identify the
Adjustment column as the index column. Yes, I am attempting to enter two
separate values in one selection. The Adjustment value is entered correctly
in the prescribed text box; however, the Output Type simply defaults to the
label in the first row that corresponds to the Adjustment value. I may need
to break the two entries up, but was hoping to combine the two.
 
Thanks Al. I added a third field called "Index" and made it an Autonumber,
but the Combo box still returns the first label that corresponds to the
Adjustment value, as if it is recognizing the Adjustment field as the primary
key. I would like for the combo box to return the label from the Output Type
field and then automatically enter the value in the Adjustment field in a
separate text box. Is this possible?
 
** Do not call your autonumber field "Index". That's a reserved word in Access. Call it
something like AdjustmentID.

Set up your combo... (ex name cboAdjustmentID)
FirstCol = Index, Second = Adjustment, Third = OutputValue
Set the combo properties...
ControlSource = AdjustmentID
ColumnCount = 3
ColumnWidths = 0"; 1"; 1" (fisrt value must be 0")
ListWidth = 2"

This setup allows you to "hide" the AdjustmentID, allow you to select by Adjustment
value, displays that Adjustment value, but really stores the AdjustmentID in the combo
"bound" field. OK, that takes care of storing the AdjustmentID, and "displaying" the
Adjustment value.
Now add an unbound field on your form named OutputValue. Give it a ControlSource of...
= cboAdjustmentID.Column(2)

This field will always display the correct OutputValue according to the AdjustmentID
stored in the cboAdjustmentID combo. Ther's no need to "save' the value, since you
captured the AdjustmentID... Adjustment and OutputValue can be derived from that on this
form, or any subsequent form, query, or report.
 
Back
Top