Not in list (Combo box) (1 Viewer)

  • Thread starter mission2java_78
  • Start date
M

mission2java_78

Guest
Combo box Not in list event..I want to be able to open a customized form because If the data that is entered isnt in the list than I want the form to display "blah not in list, add it" but along with this I need to add one more value into a field to populate this combo box. Meaning not only do I want to ask the user whether or not they want this value added but I want them to select from a combo box a list of functional groups to correspond with what they typed in. How do I do that?
I have sample code below to add the value...but I want to be able to not use a msgbox in the event but open another form and on clicking yes in this other form and selecting a valuer in a combo box to have the values added.

Code should be :
Dim db as Database
Dim rs As Recordset
If MsgBox("Value is not in list. Add it?", vbOKCancel) = vbOK Then
' Set Response argument to indicate that data
' is being added.
' Add string in NewData argument to row source.
set db=currentdb()
set rs=db.OpenRecordset("tblMyTable")
rs.addnew
rs("Field").Value = NewData
rs.Update
set rs=nothing
set db=nothing
Response = acDataErrAdded
Else
' If user chooses Cancel, suppress error message
' and undo changes.
Response = acDataErrContinue
Me.ComboName.Undo
End If
 

Users who are viewing this thread

Top Bottom