Could someone please tell me what I should be looking for to find out how to use the Not In List event to add to a concatenated field? I can only find discussions related to just adding one field.
I have a combo box filled by tblStaff "SELECT [staffid],[last] & ", " & [first] FROM tblStaff ORDER BY [last].
I can successfully get it to add [last] but not [first] using this code found in this forum
Private Sub EngDwgOwner_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_ErrorHandler
' database and recordset object variables
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblStaff")
' using the recordset object
With rs
.AddNew
.Fields("last") = NewData
I have tried .Fields("last"), ("first") = New Data
.Update
.Close
End With
Response = acDataErrAdded
Else
Me.EngDwgOwner.Undo
Response = acDataErrContinue End If
Exit_ErrorHandler:
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_ErrorHandler:
' MsgBox Err.description, vbExclamation, "Error #" & Err.Number
Resume Exit_ErrorHandler
End Sub
Thanks,
Toni
I have a combo box filled by tblStaff "SELECT [staffid],[last] & ", " & [first] FROM tblStaff ORDER BY [last].
I can successfully get it to add [last] but not [first] using this code found in this forum
Private Sub EngDwgOwner_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_ErrorHandler
' database and recordset object variables
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblStaff")
' using the recordset object
With rs
.AddNew
.Fields("last") = NewData
I have tried .Fields("last"), ("first") = New Data
.Update
.Close
End With
Response = acDataErrAdded
Else
Me.EngDwgOwner.Undo
Response = acDataErrContinue End If
Exit_ErrorHandler:
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_ErrorHandler:
' MsgBox Err.description, vbExclamation, "Error #" & Err.Number
Resume Exit_ErrorHandler
End Sub
Thanks,
Toni