"John" <Jo**@nospam.in fovis.co.uk> wrote in
news:Pq******** ************@pi pex.net:
Hi
I need to block user from moving away from a record using any
of First/Last/Prev/Next/New Record or any other way IF the
record has not been saved, and displaying a message to the
effect "Please finish editing". If however the user has
explicitly saved the record using save from the access menu
then allow to move from record. How do I achieve this via
code?
Thanks
Regards
First, let me suggest a better way. In the BeforeUpdate of your
form, you need to put validation statements for each control
that is required. If it fails the test, cancel the update, and
give your error message.
example:
if isnull(me.lastn ame) then
cancel = true
msgbox "Last Name is a required Field." & vbnewline _
& "You must enter a last name!, vbOkOnly
end if
To do what you want, you must do exactly the same things, and
also remove the built-in navigation controls from the form,
replacing them with your own. You would also need to enable and
disable these controls based on the status of whether the record
was dirty (had unsaved edits) or not.
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account from
http://www.teranews.com