I've defined the following function as an event procedure in the On Not in List:
The problem is that it does not trim the string before comparing the not in list. Is there a way to trim before the even procedure runs? To clarify what I mean it currently evaluates "Bob" and "Bob " as two different strings, I'd like to use the trim function before the check on not in list.
Any advice is greatly appreciated.
Code:
Private Sub cboLastname_NotInList(NewData As String, Response As Integer)
Dim rs As Recordset
Dim db As Database
If MsgBox(UCase(NewData) & " is not in the list of Authors." & vbNewLine & "Enter it as new Author?", vbYesNo + vbQuestion, "Confirm.") = vbYes Then
Set db = CurrentDb
Set rs = db.OpenRecordset("tblCitationAuthor")
rs.AddNew
rs!CitationAuthorLastName = NewData
rs.Update
Response = acDataErrAdded
rs.Close
Set db = Nothing
Else
Response = acDataErrContinue
End If
End Sub
The problem is that it does not trim the string before comparing the not in list. Is there a way to trim before the even procedure runs? To clarify what I mean it currently evaluates "Bob" and "Bob " as two different strings, I'd like to use the trim function before the check on not in list.
Any advice is greatly appreciated.
Last edited: