I am having trouble with the following code:
It works as is, but when I put "me.ir_code.Requery" after "Response = acDataErrAdded" to set the value to the NewData I get the following error: "Run Time error '2118': You must save the current field before you run the requery action."
I just want the added text to appear after you click Yes to add it.
Thanks
Code:
Private Sub ir_code_NotInList(NewData As String, Response As Integer)
Dim intNew As Integer
Dim strQry As String
Dim stLinkCriteria As String
intNew = MsgBox("The IR Root-Cause code '" & NewData & "' is not in the list. Would you like to add it?", vbYesNo)
If intNew = vbYes Then
strQry = "INSERT INTO tbl_ir_codes ( irc_code ) " _
& "SELECT '" & NewData & "' AS Expr1;"
DoCmd.SetWarnings (False)
DoCmd.RunSQL strQry
DoCmd.SetWarnings (True)
Response = acDataErrAdded
Else
MsgBox ("The name you entered isn't in the list.")
DoCmd.RunCommand acCmdUndo
Response = acDataErrContinue
End If
End Sub
It works as is, but when I put "me.ir_code.Requery" after "Response = acDataErrAdded" to set the value to the NewData I get the following error: "Run Time error '2118': You must save the current field before you run the requery action."
I just want the added text to appear after you click Yes to add it.
Thanks