Deleting an incomplete record

S

salmosalar

I have a form with a delete command button. Many of the text boxes and combo
boxes on the form have control sources that are required fields. When I try
to delete a record the warning comes up saying that a field cannot be null
and the record cannot be deleted.

I get around this by clicking the undo button on the tool bar.

Is there an alternative to this?
 
M

Maurice

You could try catching the warning on the On_Error property of the form.
Catch the number and then apply your own action in the On_Error from the form.

Something like:

Private Sub Form_Error(DataErr As Integer, Response As Integer)
Select case DataErr
case=(error number here...)
response = acdataerrcontinue
case= etc...
end select
end sub

hth
 
M

missinglinq via AccessMonster.com

You've already found half of the answer! Presumably a record with Required
fields not filled in is, by definition, a New Record! So at the top of your
code for your Delete button put something like this:

If Me.NewRecord Then
Me.Undo
End If
 
Top