I can't have this to work. Everytime I tried to add new
information will display the type mismatch.
Thanks for your help!
Private Sub Category_NotInList(NewData As String, Response As Integer)
Dim db As Database, rs As Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' It's not a valid category."
strMsg = strMsg & " Want to link it?"
strMsg = strMsg & " Click Yes to add or No to retype it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add Category ?" = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblecategory", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!Category = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
End Sub
information will display the type mismatch.
Thanks for your help!
Private Sub Category_NotInList(NewData As String, Response As Integer)
Dim db As Database, rs As Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' It's not a valid category."
strMsg = strMsg & " Want to link it?"
strMsg = strMsg & " Click Yes to add or No to retype it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add Category ?" = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblecategory", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!Category = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
End Sub