Unbound combo box display current record

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.
 
V

Van T. Dinh

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
 
B

BruceM

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top