From: CRC on
Hi,
I have created a blank table and given its name already. I was able to copy
the code from the example but it was for a unbound combo box. I am not quite
understanding why or how their explanation is about to make it fire for the
bound combo box. It is working fine with what I have. But Im hoping to make
it easier for the Users. Here is a sample of what is currently in use.
-------------------------------------------------------------
Private Sub Color_NotInList(NewData As String, _
Response As Integer)
Dim ctl As Control
Set ctl = Me!Color

If MsgBox("Color is not in list. Add it?", _
vbOKCancel) = vbOK Then
Response = acDataErrAdded
ctl.RowSource = ctl.RowSource & ";" & NewData
Else
Response = acDataErrContinue
ctl.Undo
End If
End Sub
From: Arvin Meyer [MVP] on
The constants:

acDataErrAdded and acDataErrContinue

allows you to add or continue. I use a generic bit of code I wrote:

http://www.datastrat.com/Code/NotInListCode.txt
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"CRC" <CRC(a)discussions.microsoft.com> wrote in message
news:173E1358-FF86-4BC1-963B-3E16823E4154(a)microsoft.com...
> Hi,
> I have created a blank table and given its name already. I was able to
> copy
> the code from the example but it was for a unbound combo box. I am not
> quite
> understanding why or how their explanation is about to make it fire for
> the
> bound combo box. It is working fine with what I have. But Im hoping to
> make
> it easier for the Users. Here is a sample of what is currently in use.
> -------------------------------------------------------------
> Private Sub Color_NotInList(NewData As String, _
> Response As Integer)
> Dim ctl As Control
> Set ctl = Me!Color
>
> If MsgBox("Color is not in list. Add it?", _
> vbOKCancel) = vbOK Then
> Response = acDataErrAdded
> ctl.RowSource = ctl.RowSource & ";" & NewData
> Else
> Response = acDataErrContinue
> ctl.Undo
> End If
> End Sub