maybe when you copy, you copy some Non-printable characters.
you delete the non-printable characters and leave just the printable ones:
Code:
Private Sub cmbGoToPr_AfterUpdate()
On Error GoTo cmbGoToPr_AfterUpdate_Err
'Remove tabs and spaces
cmbGoToPr = RemoveNonPrintable(cmbGoToPr)
cmbGoToPr = Trim$(cmbGoToPr)
'Now search for record
DoCmd.SearchForRecord , "", acFirst, "[PrNumber] = " & "'" & Screen.ActiveControl & "'"
cmbGoToPr_AfterUpdate_Exit:
Exit Sub
cmbGoToPr_AfterUpdate_Err:
MsgBox Error$
Resume cmbGoToPr_AfterUpdate_Exit
End Sub
Function RemoveNonPrintable(strInput As String) As String
Dim regEx As Object
Set regEx = CreateObject("VBScript.RegExp")
With regEx
.Global = True
.IgnoreCase = True
' Match all characters except printable ASCII (32–126)
.Pattern = "[^\x20-\x7E]"
End With
RemoveNonPrintable = regEx.Replace(strInput, "")
End Function