entering data on the form

K

Kushum

hi,
I would like to know how I can set my form so that the records don't get
saved automatically.
I have a form where you can enter and edit data but the problem is that I
have novice users so the first thing they do is automatically think that the
form is like a search form and start entering data which gets saved
automatically when you close it or use the scroller on the mouse.
So i need not the data to be saved automatically until they havent hit the
save macro button on the form.
Thanks in advance.
 
R

Rick Brandt

Kushum said:
hi,
I would like to know how I can set my form so that the records don't
get saved automatically.
I have a form where you can enter and edit data but the problem is
that I have novice users so the first thing they do is automatically
think that the form is like a search form and start entering data
which gets saved automatically when you close it or use the scroller
on the mouse.
So i need not the data to be saved automatically until they havent
hit the save macro button on the form.
Thanks in advance.

You cannot change the AutoSave behaviour without going to an unbound form, but
you can use the BeforeUpdate event to raise a "Do you want to save your
changes?" prompt and cancel the update if they say No.

If MsgBox("Save Changes", vbYesNo) = vbNo Then
Cancel = True
Me.Undo
End If

This strategy has issues and is generally annoying to users who do know what
they're doing. A better strategy is to lock all controsl on the form by default
and then provide an [Edit Record] that unlocks them. That should eliminate
accidental changes.

Ultimately though users who are allowed to make edits have to be trained and
have to NOT be morons.
 
O

Ofer

On the before update event of the form, you can enter the code
If MsgBox("Save", vbOKCancel) = vbOK Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If

That will prompt the user if he/she wants to save the record, if no, the
changes will undo.
 
Top