Adding values in combo box on form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to add values into a combo box that aren't already there, wanting
the combo box updated. The combo box is fed from a separate table in the
database.

The combo box is DesignEngineer, the table is Design Engineers.

I have made the following procedure in the NotInList property of the combo
box:

Private Sub DesignEngineer_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_DesignEngineer_NotInList

DoCmd.OpenTable "Design Engineers", acViewDatasheet, acAdd
Response = acDataErrAdded
Exit_DesignEngineer_NotInList:
Exit Sub
Err_DesignEngineer_NotInList:
MsgBox Err.Description
Resume Exit_DesignEngineer_NotInList
End Sub

LimitToList is set to Yes.

When I type a new value into the combo box and hit enter. a new table (in
DataSheet view) pops up and I get the message:

"The text you entered isn't an item on the list. Select an item from the
list, or enter text that matches one of the listed items."

Any ideas?
 
You shouldn't be working with tables like that. If nothing else, create a
form.
 
The combo box I am using is in a form. Are you saying I should fill my Design
Engineers table with a form, and then use the Open Form procedure to update
the table with values not already in the table?
 
If you need to provide additional information to fully populate the Design
Engineers table on an addition, then yes, I'd say create a form and open the
form in your NotInList event.
 
Hey, thanks!

It worked just the way I wanted it to. I've added this feature to several
other tables that support the original form...very nice.

Tanks again for your help.
 
Back
Top