Adding values in combo box on form

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?
 
D

Douglas J Steele

You shouldn't be working with tables like that. If nothing else, create a
form.
 
G

Guest

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?
 
D

Douglas J Steele

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

Guest

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.
 

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