B
bladelock
The "Yes" and " No" conditions work well. I want to add an "Add" button with the condition to add another record even thought it's a duplicate. Can someone help?
Here is my code that needs the "add" condition:
Dim rs As DAO.Recordset ' be sure Tools... References has DAO checked
Dim iAns As Integer
Set rs = Me.RecordsetClone
rs.FindFirst "[MEDREC] = '" & Me!MEDREC & "' And [DOCCRS]= #" & Me!DOCCRS & "#"
If Not rs.NoMatch Then
iAns = MsgBox("This record already exists! Jump to it?", vbYesNo)
If iAns = vbYes Then
' Clear the current form, jump to the record
Me.Undo
Cancel = True
Me.Bookmark = rs.Bookmark
Else
' Just clear the medicalrecord textbox, let them try again
Cancel = True
Me!MedicalRecord.Undo
End If
End If
Here is my code that needs the "add" condition:
Dim rs As DAO.Recordset ' be sure Tools... References has DAO checked
Dim iAns As Integer
Set rs = Me.RecordsetClone
rs.FindFirst "[MEDREC] = '" & Me!MEDREC & "' And [DOCCRS]= #" & Me!DOCCRS & "#"
If Not rs.NoMatch Then
iAns = MsgBox("This record already exists! Jump to it?", vbYesNo)
If iAns = vbYes Then
' Clear the current form, jump to the record
Me.Undo
Cancel = True
Me.Bookmark = rs.Bookmark
Else
' Just clear the medicalrecord textbox, let them try again
Cancel = True
Me!MedicalRecord.Undo
End If
End If