Updating a ComboBox as new records are added

  • Thread starter Thread starter george via AccessMonster.com
  • Start date Start date
G

george via AccessMonster.com

Ok, so I have a combo box that lists all of the different companies that we
serve. The row source of that combo box is set to get all of the vendors
from the vendors table. Then when you select a vendor, it shows the data
below so you can edit it.

I want that combo box to show a new record when the user enteres a new
company. Like if they scroll to the end of the list and add a company, I
want them to be able to select it from the combo box. My attempt at having
it do this is:

Private Sub CompanyName_Change()

Me.CompanySelect.RowSource = "SELECT Vendors.VendorID, Vendors.CompanyName
FROM Vendors ORDER BY [CompanyName];"
Me.CompanySelect.Requery

End Sub

But this does not add the new record. It does update a name if you changed
the name of the company, but thats about it.

Help would be greatly appreciated!

~George
 
In the form's AfterInsert event try the requery of the combo box. Until the
record is written to the table, you won't be able to get it to show in the
combo box.
 
Back
Top