Set doc = view.GetDocumentByKey(key) Set doc = view.GetDocumentByKey(key,True)と変更すれば Trueを省略すると先頭一致で検索されます。Trueを指定すると 完全一致のものが検索されます。 私も確認しましたが、先頭文字が¥の場合うまくチェックできません。 上のオプション指定した上で、入力文字の先頭に¥を入力させない ようにする方法。 付け焼刃ですがこういった方法も考えられます。 この場合の欠点は、GetDocumentByKeyは最初に発見された文書しか 取得きないことです。 そこで、Set notesDocumentCollection = notesView.GetAllDocumentsByKey( keyArray,True) を使い、間違って検索された部分を直接値比較すれば完璧になると 思います。 Dim workspace As New NotesUIWorkspace Dim uidoc As NotesUIDocument Dim session As New NotesSession Dim db As notesdatabase Dim view As notesview Dim doc As notesdocument Dim sdoc As notesdocument Set uidoc = workspace.CurrentDocument Set db = session.currentdatabase Set doc=uidoc.document Dim key As String '新規文書フォーム上のナンバーフィールド値取得 key = doc.Code(0) '************ 重複番号チェック ****************** '同じデータベース内のカウント管理用ビュー取得 Set view = db.Getview("L") Set sdoc = view.GetDocumentByKey(key,True) If (sdoc Is Nothing) Then '先頭に\が付くと\AAでも\Aも検索されてしまう為中身が一致しているか再度チェックする。 If sdoc.code(0)=doc.code(0) Then Msgbox("コードに入力された値はすでに存在しますので、値を変更してください") Else Msgbox("なし") End If Else Msgbox("コードに入力された値はすでに存在しますので、値を変更してください") End If