Close form without saving

Richio

Registered User.
Local time
Today, 22:22
Joined
May 31, 2002
Messages
75
I have a form which I have tried to make pretty much foolproof in terms of data entry.

On closing the form it checks for fields with null values and does not allow it to close unless an entry is made.

This is great.....but.......people want to be able to quit the form without saving any of the data. Ie they get halfway through and change their mind (why do people do this)

Even if I try and delete the record it comes up with a message stating can't do that as related records in another table are required.

Is there a simple way to include a "Quit" button on the form which effectively ignores everything that has been entered and then closes the form

Thanks

R
 
I needed to do similar, here's what I did

set in code when something is typed into the first field, all exit buttons from the form are blocked (Enabled = False)

then create a confirm button, when pressed the record is saved (and checks that all fields have been completed) and the exit buttons are unlocked.

then create an undo button, when pressed undoes the updates and closes the form
 
I find the best way to achieve total control is not to have a data entry form populated from the table. I use all unbound fields/combos/checkboxes etc., and have a Save button, which verifies all the inputs and then saves the data to the table(s).

The exits are trapped by code which asks if the user is sure they want to quit without saving the record. It's quite easy and totally controllable.

I keep directly populated forms for editing, selection, reporting, querying etc, and even then I'll pop-up up the above form for additions.

Does this make me a control freak?

I do know our company has bought a database application which cost thousands and will continue to cost thousands/year in licences and it is riddled with errors and basic programming bugs and flaws and poor design. How do they get away with it?

Dave E
 
Private Sub Cancel_Click()
On Error GoTo Err_Cancel_Click


If Me.Dirty Then
Me.Undo
Else
MsgBox "There is nothing to Undo"
End If

Exit_Cancel_Click:
Exit Sub

Err_Cancel_Click:
MsgBox Err.Description
Resume Exit_Cancel_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom