NotInList Problem

S

Sher

I have (3) NotInList in my database. One for TYPINV, one for SSN and one for
Organization. They are exactly the same. My problem is only Organization
works. The other two keep saying an error occured, please try again. What
can I do to get this from occurring and have the information appear.


Private Sub ORGANIZATION_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String

strMsg = "'" & NewData & "' is not an available Organization " & vbCrLf
& vbCrLf
strMsg = strMsg & "Do you want to add the new Organization to the
current list?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add."

If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new Organization?") = vbNo
Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("Organization", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!ORGANIZATION = NewData
rs.Update

If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End If
End Sub
 
D

Douglas J. Steele

Change from

MsgBox "An error occurred. Please try again."

to

MsgBox "Error " & Err.Number & " (" & Err.Description & ") occurred. Please
try again."

and tell us what the error is.
 
S

Sher

Hello Douglas

That is still not working.

Douglas J. Steele said:
Change from

MsgBox "An error occurred. Please try again."

to

MsgBox "Error " & Err.Number & " (" & Err.Description & ") occurred. Please
try again."

and tell us what the error is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top