NotInList

sonmic
sonmic used Ask the Experts™
on
Hallo,

I use a notinlist event in combination with Docmd.Openform. Then i fill in the new data. When i return to my form i still get the message "Item notinlist".
acDataErrAdded does not work because i open another form?

DoCmd.Hourglass True
    Dim strmsg As String, docname As String
    Dim db As DAO.Database, rs As DAO.Recordset
    strmsg = "Taxnumber " & NewData & " isn't in the list." & vbCrLf
    strmsg = strmsg & "Do you want to add?"
    If MsgBox(strmsg, vbQuestion + vbYesNo, msgkop) = vbNo Then
        Response = acDataErrContinue
    Else
        Set db = CurrentDb()
        docname = "AddTax"
        DoCmd.OpenForm docname, acFormAdd, acDialog, NewData
        If err Then
          Response = acDataErrContinue
        Else
          Response = acDataErrAdded
        End If
    End If

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
you did not include the codes to add the item to the table

see this link

http://support.microsoft.com/?kbid=197526

Author

Commented:
The number i want to add isthe key, but when i put in the number need also the usernumber and articlenumber, both comboboxen in the originaal form. When i cannot open the form then i have to ask for 3 field. The problem is that the user must be able to select them.

Commented:
Nowhere have you opened a recordset so something may be put into a table.
Top Expert 2016

Commented:
look at Method 2: Using a Form to Add a New Record
in the link posted above

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial