locked
Combo Box Value showing ID instead of value RRS feed

  • Question

  • I created a Combo box on a form.  I have VBA code behind the combo box - On change that will auto populate two other fields. 

    The column count is 3 and the column count widths are 0; 1.4; 1 - i could change it to 0; 2;2.  the problem i have is that when i save my record, it saves the ID to the combo box field instead of a text value, which is column 1.

     

    olu Solaru

    Monday, July 22, 2019 3:19 PM

All replies

  • ...............the problem i have is that when i save my record, it saves the ID to the combo box field instead of a text value, which is column 1.
    Which is exactly what it should be doing.  The other columns are functionally determined by the key of the referenced table.  Any referencing table should have only a foreign key whose value is that of the primary key in the relevant row of the referenced table.  To do otherwise would introduce redundancy and the consequent risk of update anomalies due to the table not being normalized top Third Normal Form (3NF).

    Ken Sheridan, Stafford, England

    Monday, July 22, 2019 9:19 PM
  • in a combobox the bound value is a property in the data tab

    it will default to 1 which means the most left field/column of the Row Source

    press the ellipsis … to open the table/query row source and note which is most left

    what the combobox displays is controlled by your column widths  0; 1.4; 1 - which in this case then won't display the bound value assuming the bound property is set to 1.

    the column count begins with 0 meaning that if you wanted an unbound textbox to display the third column's value, it's record source would be:

    =ComboboxName.column(2)

    You state that you are writing the values of column 3 into the form's record - - but that may not always be the best idea - and instead just display it as I show.  This is a decision based on knowing your data.  If the value in column 3 changes do you want the displays to change or not - - and would you have to rewrite data or manage the data being out of sync.... the approach is based entirely on what's appropriate for the type of info...

    Thursday, July 25, 2019 7:21 PM