Hi,
Sorry if this is an easy fix I'm a newbie.
I have a database
ID Date Serial Number
1 17/02/16 90001234
2 17/02/16 90001243
3 17/02/16 90001212
4 17/02/16 90009999
5 17/02/16 90009999
I am using a form to enter the data.
I have a macro which checks if the serial number has been previously used.
This is before update.
The macro is:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If DCount("ID", "YourTableName", "[Serial Number] = '" & Me.[Serial Number] & "'") > 0 Then
Response = MsgBox ("Serial Number previously used.Click Yes to continue or No to clear.", VbQuestion + VbYesNo
If Response = vbNo then ****Clear form code ****
End If
End If
End Sub
The code check if the serial number has been previously used.
If it has it asked you the Question to continue or clear.
If you continue it updates the database.
I need it to clear the form when No is clicked.
Any ideas greatly appreciated