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
        Set db = CurrentDb()
        docname = "AddTax"
        DoCmd.OpenForm docname, acFormAdd, acDialog, NewData
        If err Then
          Response = acDataErrContinue
          Response = acDataErrAdded
        End If
    End If

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
you did not include the codes to add the item to the table

see this link

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sonmicAuthor 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.
Nowhere have you opened a recordset so something may be put into a table.
Rey Obrero (Capricorn1)Commented:
look at Method 2: Using a Form to Add a New Record
in the link posted above
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.