ComboBox LimitToList/Dropdown problem

G

George Akers

I have a ComboBox with LimitToList set to Yes. When the user enters a
new value(not in list) I call a routine to add that value to the list.
Prior to that I put up a MsgBox asking the user if that is what they
want to do. If they select no I return to the ComboBox and perform an
Undo. The problem is that the list is always dropped down when control
returns to the user. Does anyone know how to avoid this? Here is the
NotInList Event:

Private Sub cboContact_NotInList(NewData As String, Response As Integer)
On Error GoTo cboContact_NotInListErr

Dim intAddRow As Integer

AddNewRows "tblContacts", intAddRow
If intAddRow = vbNo Then
Me.cboContact.Undo
End If

Response = 0

cboContact_NotInListExit:

Exit Sub

cboContact_NotInListErr:
MsgBox Err.Description, , "Runtime Error # " & Err.Number & " in "
& Err.Source
Resume cboContact_NotInListExit
End Sub



TIA, George
 
G

Guest

You can find the NotInList event going through the code page.

Open the code page, on the combobox on top at left, select your combobox,
next select the NotInList event on the right combobox

Mauricio Silva
 
G

George Akers

Thanks Mauricio. If you look at the bottom of my original post you can
find the code that is in the NotInList event for the ComboBox in question.
 

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