Form's Before Update event always runs before deleting record

M

Martin

I've got some fairly involved validation code run by my form's Before Update
event that tells the user if they've not typed some essential data and asks
if they want to now fill it in (by way of the MsgBox function).

The annoying thing is that if they decide to delete the record having left
some of the vital fields empty, the first prompt they see is my message box
which they then have to click through before getting the familiar delete
record confirmation message. Is there any way to capture the fact they're
deleting so that the Before Update event can be sidestepped? The form's
Delete event runs after the Before Update so I can't use this.
 
K

Klatuu

What method are you using to "delete" the new record? In reality, you are
not doing a delete because the record is not yet in the database. The Delete
event will not fire in this case.

I believe if you use the UnDo method, you will not have this problem.
 
M

Martin

Sorry - perhaps I haven't been clear. I mean if the user decides to delete
the record in the normal way (e.g. Edit, Delete Record) halfway through
typing a new record.
 
K

Klatuu

If you allow Users to use the Access Menu, I think there is really nothing
you can do to prevent the messages you are getting.
To better control your application, Hide the Access Menu and if you need
menu items, build you own custom menu.
Also, in my forms' Current event I have
Me.cmdDelete = Me.NewRecord
So they can only use the Undo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top