I am attempting to set the value of a combo box from a "Splash Screen" type form in Access that will take the user's computer name and load two combo boxes on another form with the Employee ID and Manager ID, which are both bound columns of the combo boxes, which are unbound themselves. I can get the IDs in the combo box, but i want it to still display column 2 (Names) of both combo boxes. Right now it just displays the IDs. Anyone got any ideas how i can get it to react like i actually picked it in the combo box?
1 Answers
0
votes
So, comboboxes can sometimes be tricky, but once you get it down you should be good to go.
So, when looking at a Combobox's properties,
The Format
tab :
ColumnCount: 2 <-- You want the ID and the Name
ColumnWidths: 0";1" <--- You're hiding the ID field, which is the first column
The data
tab:
This is where you're going to tell Access what data you're supplying for your combobox.
Usually it's a query or table data source. If it's a query you should be selecting the ID
and Name
fields, and use that query in the RowSource
property in the Data
tab.
Row Source: Select ID, Name FROM YourTable
Row Source Type: Table/Query
When you use the Wizard to create the combobox, it's fairly straightforward. When Access asks you to format your data source, you completely shrink the ID
column, so it hides it (but it's still there).
The steps would be:
- I want the combobox to look up the values in a table or query
- Select the Table or Query
- Select the Fields (ID and Name seem appropriate for your scenario)
- Any sorting you may want
- The next screen is where we want to hide our
ID
column, so shrink it entirely - The next screen is where we tell Access that we want the
ID
to be in scope (selected) when we select a combobox item - Name it & be proud