Unbound combo box display current record

  • Thread starter Thread starter BruceM
  • Start date Start date
B

BruceM

I can set up an unbound combo box to select a record (such as an Employee
record) based on what I select in the combo box, but I would also like to
have the Employee name displayed in the combo box when I open the form or
scroll to a new record. The only way I have found to do this is to add a
text box bound to the Employee field, and to place it on top of the combo
box. It seems there should be a way to view the current record directly in
the combo box, but I have not been able to discover the method.
 
If you are using the bound Form then you can use the Form_Current Event to
set the value of the ComboBox to show the current Employee on the Form. For
example, if you have the Field EmployeeID in the Form's RecordSource and the
BoundColumn (note: unbound Combobox still have the BoundColumn Property) is
also EmployeeID, you can use something like:

Me.ComboBox1 = Me.EmployeeID
 
Thanks for the reply. I see what I was doing wrong. I tried to place the
employee's name into the combo box, rather than the EmployeeID, which is the
bound column. When I substituted EmployeeID it worked just fine. I must
have thought that since I wanted the name to appear I needed to place the
name itself into the combo box. It was Friday afternoon, so I'm not really
sure what I was thinking, but that is my best guess.
 
Back
Top