I have a "New Record" button to allow entry of new records. In the Form_BeforeUpdate I validate the data the user entered. If they try to enter a duplicate record, I want to Cancel the Save, display a message that they are trying to enter a duplicate record.
How do I select the existing record so the user can change the existing record or how do I cancel adding a New Record.changes.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim intDCount As Integer
Dim blnResponse As Boolean
On Error GoTo ErrTrap
intDCount = DCount("*", "tblOrders", "[strOrderID] = '" & Me.cboOrder & "' AND [dteArriveDate] = #" & Me.txtArriveDate & "#")
If intDCount > 0 Then
MsgBox "Attempted Duplicate Process. Please fix data"
Cancel = True
Else
Thanks.
Sandy