How to bypass the before update event when a record is deleted

Good it works now, luck with it. :)
It think it was the error no. 3167 I add!
 
Thanks. It worked. Sorry for the late reply.

Isn't this forum just awesome? Thanks to all the great folks like you who are willing to help.



I'm not observing the same as you, as soon I click "Yes", (in your MsgBox), to delete the record it disappear, (also without any runtime error).
But I see you missing a "Exit Sub" in your code else you'll run into the error handling part.
Did you download the database? I don't know what the difference in your set up and in mine, because as mention above I'm not getting any error message.
Only for testing purpose, set your subform's property "Allow deletion" to "Yes" in design view, and the try to delete a record from the menuline or right click an chose "Delete Record", (mark the whole record).
Code:
...
  Me.Form.Requery
  Pause (0.1)
  Me.Form.Repaint
End If
[B][COLOR=Red]Exit Sub[/COLOR][/B]

actioncode_change_err:
Hope you're still alive. :D
For avoiding writing to the logfile, make your if structure active again,(in the form's before update).
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)

On Error GoTo BeforeUpdate_Err
'WriteSubFormChanges Me
[B][COLOR=Red]If Me.ACTIONCODE.Value <> "CS90" Then
[/COLOR][/B]'If IsNull(Me.ACTIONCODE.Value) = False Then
  Call WriteChanges([Form])
[B][COLOR=Red]End If[/COLOR][/B]
 

Users who are viewing this thread

Back
Top Bottom