I have a Not in List Event on another subform in my database works great.
So, applied same criteria to a new subform.
Now when I go to create the Not in List Event I get this error:
Automation error
Unspecified error
Now I have other Not in List Events scattered throughout my forms, but when I get this error and the blank code window closes it brings up the previous subforms code window and it is all highlighted?
It's almost like its telling me you already have one of those you can't have 2 in the same database?
I would try different code for the Not in List Event but I can't even get that far?
The Original Code for the working subform is:
Private Sub ExperienceID_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database, rst As DAO.Recordset
Dim Msg As String, Style As Integer, Title As String, DL As String
DL = vbNewLine & vbNewLine
Msg = "'" & NewData & "' is not an available item " & DL & _
"Do you want to add this item to the current list? " & DL & _
"Click Yes To Add " & NewData & " to the list" & DL & _
"Click No to re-type it."
Style = vbQuestion + vbYesNo
Title = "Add New Item?"
If MsgBox(Msg, Style, Title) = vbNo Then
Me!Experience.Undo
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rst = db.OpenRecordset("tblExperience", dbOpenDynaset)
rst.AddNew
rst!Experience = NewData
rst.Update
Response = acDataErrAdded
End If
Set rst = Nothing
Set db = Nothing
End Sub
The new subform isn't on the same mainform nor does it share any criteria besides the jobproposalno field?
So, applied same criteria to a new subform.
Now when I go to create the Not in List Event I get this error:
Automation error
Unspecified error
Now I have other Not in List Events scattered throughout my forms, but when I get this error and the blank code window closes it brings up the previous subforms code window and it is all highlighted?
It's almost like its telling me you already have one of those you can't have 2 in the same database?
I would try different code for the Not in List Event but I can't even get that far?
The Original Code for the working subform is:
Private Sub ExperienceID_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database, rst As DAO.Recordset
Dim Msg As String, Style As Integer, Title As String, DL As String
DL = vbNewLine & vbNewLine
Msg = "'" & NewData & "' is not an available item " & DL & _
"Do you want to add this item to the current list? " & DL & _
"Click Yes To Add " & NewData & " to the list" & DL & _
"Click No to re-type it."
Style = vbQuestion + vbYesNo
Title = "Add New Item?"
If MsgBox(Msg, Style, Title) = vbNo Then
Me!Experience.Undo
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rst = db.OpenRecordset("tblExperience", dbOpenDynaset)
rst.AddNew
rst!Experience = NewData
rst.Update
Response = acDataErrAdded
End If
Set rst = Nothing
Set db = Nothing
End Sub
The new subform isn't on the same mainform nor does it share any criteria besides the jobproposalno field?