R
rblivewire
I am trying to add a name to the combo box after a user puts it in if
it is not already in the box. Found this on the internet. I changed
the Set rs = db.OpenRecordset("tblAE", dbOpenDynaset) to Set rs =
db.OpenRecordset("Tool Tracking List", dbOpenDynaset). It seems as if
the code skips and goes straight to the errorr message: MsgBox "An
error occurred. Please try again." The no works fine, but I can't get
it to save the entry in the combo box. Anyone see anything wrong?
Private Sub Project_Requestor_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 AE Name " & vbCrLf
& vbCrLf
strMsg = strMsg & "Do you want to associate the new Name to the
current DLSAF?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to link or No to
re-type it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo
Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("Tool Tracking List", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!AEName = 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
it is not already in the box. Found this on the internet. I changed
the Set rs = db.OpenRecordset("tblAE", dbOpenDynaset) to Set rs =
db.OpenRecordset("Tool Tracking List", dbOpenDynaset). It seems as if
the code skips and goes straight to the errorr message: MsgBox "An
error occurred. Please try again." The no works fine, but I can't get
it to save the entry in the combo box. Anyone see anything wrong?
Private Sub Project_Requestor_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 AE Name " & vbCrLf
& vbCrLf
strMsg = strMsg & "Do you want to associate the new Name to the
current DLSAF?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to link or No to
re-type it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo
Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("Tool Tracking List", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!AEName = 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