I'm hoping someone can help a noob with a simple problem
I did a search but couldn't find the answer.
When a user clears a record and leaves it Null I would like to prompt them whether they would like to delete the record before the access error message about invalid use of Null comes up. If they don't want to delete the record then the code should undo the change. The problem I have is I can't seem to run my code without the access error coming up. I can't see where I can trap the error (err.Number 3398).
For example, this doesn't work:
I know I can put in a validation rule, but I would like to go a bit further.
Does anyone have any suggestions?
When a user clears a record and leaves it Null I would like to prompt them whether they would like to delete the record before the access error message about invalid use of Null comes up. If they don't want to delete the record then the code should undo the change. The problem I have is I can't seem to run my code without the access error coming up. I can't see where I can trap the error (err.Number 3398).
For example, this doesn't work:
Code:
Private Sub txtSalesItem_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_txtSalesItem_BeforeUpdate
Dim response as Integer
If IsNull(Me.txtSalesItem) Then
response = MsgBox("Do you want to delete this category?", vbExclamation + vbYesNo, "Delete Sales Item?")
If response = 6 Then
Runcommand acCmdDelete
else
RunCommand acCmdUndo
endif
End If
.
.
.
I know I can put in a validation rule, but I would like to go a bit further.
Does anyone have any suggestions?