I have the following code as a property to a field(beforeUpdate)
After i get the the message box and i click ok i want to set the id value to null but i get the following error "The macro or function se to BeforeUpdate or validationRule property for this field is preventing Microsoft Office Access from saving tha data in the field."
Any suggestions?
Thank you in advance!
Code:
Private Sub ID_BeforeUpdate(Cancel As Integer)
Dim strSQL As String
Dim rs As DAO.Recordset
strSQL = "SELECT * FROM RETIREMENT " & _
"WHERE [ID] = " & Me.ID & ""
Set rs = CurrentDb.OpenRecordset(strSQL)
If Not (rs.EOF) Then
MsgBox ("Cannot insert record.")
Me.ID.Value = Null
End If
End Sub
After i get the the message box and i click ok i want to set the id value to null but i get the following error "The macro or function se to BeforeUpdate or validationRule property for this field is preventing Microsoft Office Access from saving tha data in the field."
Any suggestions?
Thank you in advance!