Supress "Not in List" message (1 Viewer)

Derrick T. Davidson

Registered User.
Local time
Tomorrow, 01:56
Joined
Jan 31, 2016
Messages
15
I have an event on the not in list which opens a form to add the item. However I still get the access message the item is not in the list. I have tried set warnings to false however it either doesn't work and the message appears or if I include it in my code it says this is not an option, my code is below is there anywhere I can add setWarnings in it??

Code:
 Private Sub groSubBrand_NotInList(NewData As String, Response As Integer)
 
    Dim intAnswer As Integer
              intAnswer = MsgBox("This Item, " & Chr(34) & NewData & _
         Chr(34) & " is not currently in the Brand item list." & vbCrLf & "Would you like to add it to the Brand list now?", vbQuestion + vbYesNo, "Brand List")
    If intAnswer = vbYes Then
        'Open Item List
        DoCmd.OpenForm "frmGroItems", acNormal, "", "", , acNormal
        DoCmd.GoToRecord acForm, "frmGroItems", acLast
    Else
         'Change message and title
         MsgBox "Please choose an item from the list.", vbInformation, "Brand Item List"
         Response = acDataErrContinue
    End If
End Sub
 

bob fitz

AWF VIP
Local time
Today, 18:56
Joined
May 23, 2011
Messages
4,729
Try this:
Code:
Private Sub groSubBrand_NotInList(NewData As String, Response As Integer)
 
    Dim intAnswer As Integer
              intAnswer = MsgBox("This Item, " & Chr(34) & NewData & _
         Chr(34) & " is not currently in the Brand item list." & vbCrLf & "Would you like to add it to the Brand list now?", vbQuestion + vbYesNo, "Brand List")
    If intAnswer = vbYes Then
        'Open Item List
        DoCmd.OpenForm "frmGroItems", acNormal, "", "", , acNormal
        DoCmd.GoToRecord acForm, "frmGroItems", acLast
        [COLOR="Red"]Response = acDataErrAdded[/COLOR]
    Else
         'Change message and title
         MsgBox "Please choose an item from the list.", vbInformation, "Brand Item List"
         Response = acDataErrContinue
    End If
End Sub
 

bob fitz

AWF VIP
Local time
Today, 18:56
Joined
May 23, 2011
Messages
4,729
How about:
Code:
Private Sub groSubBrand_NotInList(NewData As String, Response As Integer)
 
    Dim intAnswer As Integer
              intAnswer = MsgBox("This Item, " & Chr(34) & NewData & _
         Chr(34) & " is not currently in the Brand item list." & vbCrLf & "Would you like to add it to the Brand list now?", vbQuestion + vbYesNo, "Brand List")
    If intAnswer = vbYes Then
        'Open Item List
        DoCmd.OpenForm "frmGroItems", acNormal, "", "", , [COLOR="Red"]acDialog[/COLOR]
        DoCmd.GoToRecord acForm, "frmGroItems", acLast
        Response = acDataErrAdded
    Else
         'Change message and title
         MsgBox "Please choose an item from the list.", vbInformation, "Brand Item List"
         Response = acDataErrContinue
    End If
End Sub
 

Users who are viewing this thread

Top Bottom