Getting a combo box to show a descrion, but enter an associted codeID into control source

  • Thread starter Thread starter Spidey3721
  • Start date Start date
S

Spidey3721

I have a form used for entering in different material selections for many
different condo units, which includes a combobox, [Light Fixture Combo] that
I want to use to record which light fixture goes into each unit (record)

I want the combobox to display the actual description of the fixture (from
the Light Fixtures table), but I want it to actually enter in the
appropriate FixtureID into the Owner Selection table - I do NOT want the
user to need to know, or even see the FixtureID's...

tbl Light Fixtures
FixtureID (Primary Key)
Fixture Name
Fixture Description
etc....
end tbl

tbl Owner Selections
UnitID (foreign key to 'Project info' table
FxitureID (foreign key to
LightCost
 
If you use the combo box wizard, it will accomplish exactly what you desire. Just enter the fixture number in the FixtureID field (this should be a text data type). The wizard will hide the primary key in the combo box, allowing only the description (or whatever field you use) to show.

Allan
 
Try a DLookup Command. See a full description with examples by
looking up Microsoft Knowledge Base # 136122

Carlos Alberto-Brasil
 
In your combo box properties, make sure your row source includes to columns.
Set the width of the first column (the ID column) to 0, and set the bound
column = 1. Set the width of the second column (the description) = 1.25, or
however wide you want it. This will display the description to choose from,
but it will save the ID value in the database.

Robert Smith
Kaizen Software Solutions
http://www.kzsoftware.com/services/msaccess
 
Back
Top