ありがとうとざいます。 ここでうまくいってないみたいで、 key = doc.Code(0) If sdoc.code(0)=doc.code(0) Then これでやってみました。同じ事ですよね? key = doc.GetItemValue("Code1")(0) If key = sdoc.GetItemValue("Code1")(0) Then でもこれもまたエラーが出るんです(TT) 今から外出なので...来週もう少しじっくりやってみます。 勝手言いますが、もう少しお付き合いおねがします。 行ってきます〜 Sub Exiting(Source As Field) 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) key = doc.GetItemValue("Code1")(0) 'Key = uidoc.FieldGetText("Code1") key=convChr(key,"\","") '************ 重複番号チェック ****************** '同じデータベース内のカウント管理用ビュー取得 Set view = db.Getview("KOKYAKU") Set sdoc = view.GetDocumentByKey(key,True) If (sdoc Is Nothing) Then '先頭に\が付くと\AAでも\Aも検索されてしまう為中身が一致しているか再度チェックする。 If key = sdoc.GetItemValue("Code1")(0) Then Msgbox("コードに入力された値はすでに存在しますので、値を変更してください") Else Msgbox("なし") End If Else Msgbox("コードに入力された値はすでに存在しますので、値を変更してください") End If End Sub