Make sure the Combo's "limit to list" property is set to yes. Create a form to add the new data on. Then under "NotInList" event add something like this...
Private Sub cboCaseNumber_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_cboCaseNumber_NotInList
Dim intNewCategory As Integer, strTitle As String, intMsgDialog As Integer
strTitle = "CASE NUMBER NOT FOUND"
intMsgDialog = vbYesNo + vbQuestion + vbDefaultButton1
intNewCategory = MsgBox("Do you want to add this Case Number?", intMsgDialog, strTitle)
If intNewCategory = vbYes Then
DoCmd.RunCommand acCmdUndo
DoCmd.OpenForm "formNewCaseNumber", acNormal, , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
End If
Exit_cboCaseNumber_NotInList:
Exit Sub
Err_cboCaseNumber_NotInList:
MsgBox Err.Description
Resume Exit_cboCaseNumber_NotInList
End Sub
I just copied this from one of my databases...hope it helps.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.