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
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