R
Rob
"Bryan Black";"Chandra Sekhar";"Dharm";"Donald Smith";"Gregory
Sierchula";"Lisa L. Suk";"Robert Sytek";"Scott Harvey";"Thomas Nash";"Thomas
Winningham";"Trinity Burns"
I have created a combo box and have set the Row Source Type to a "Value
List". I have created the above list and typed this into the Row Source
field. I have created the following code for the "Not In List" property:
Private Sub Combo33_NotInList(NewData As String, Response As Integer)
Dim ctl As Control
' Return Control object that points to combo box.
Set ctl = Me!Combo33
' Prompt user to verify they wish to add new value.
If MsgBox("Value is not in list. Add it?", _
vbOKCancel) = vbOK Then
' Set Response argument to indicate that data
' is being added.
Response = acDataErrAdded
' Add string in NewData argument to row source.
ctl.RowSource = ctl.RowSource & ";" & NewData
Else
' If user chooses Cancel, suppress error message
' and undo changes.
Response = acDataErrContinue
ctl.Undo
End If
End Sub
Everything works fine except that the new data does not get added to the Row
Source. I would also like it if I can sort the values once the new data gets
added. Can someone please help?
Rob
Sierchula";"Lisa L. Suk";"Robert Sytek";"Scott Harvey";"Thomas Nash";"Thomas
Winningham";"Trinity Burns"
I have created a combo box and have set the Row Source Type to a "Value
List". I have created the above list and typed this into the Row Source
field. I have created the following code for the "Not In List" property:
Private Sub Combo33_NotInList(NewData As String, Response As Integer)
Dim ctl As Control
' Return Control object that points to combo box.
Set ctl = Me!Combo33
' Prompt user to verify they wish to add new value.
If MsgBox("Value is not in list. Add it?", _
vbOKCancel) = vbOK Then
' Set Response argument to indicate that data
' is being added.
Response = acDataErrAdded
' Add string in NewData argument to row source.
ctl.RowSource = ctl.RowSource & ";" & NewData
Else
' If user chooses Cancel, suppress error message
' and undo changes.
Response = acDataErrContinue
ctl.Undo
End If
End Sub
Everything works fine except that the new data does not get added to the Row
Source. I would also like it if I can sort the values once the new data gets
added. Can someone please help?
Rob