Deleting an incomplete record

G

Guest

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?
 
G

Guest

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

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 

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