strSQL = "SELECT * FROM FinalConfirm WHERE RefNo Like '*" & getOrgRefNo(Forms![F_FConf]![cboRefNo]) & "*'and refno <> '" & Forms![F_FConf]![cboRefNo] & "'"
Function getOrgRefNo(str As String) As String Dim i As Integer i = InStr(1, str, "-") If i > 0 Then getOrgRefNo = Left(str, i - 1) Else getOrgRefNo = str End If
End Function
我改成这样就实现了