473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Prohibit record navigation

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
Jun 13 '06 #1
6 5465
One way is to set the Required property of all the fields in the
underlying table to True. Then the user won't be able to leave the
record without filling out all the fields.

Jun 14 '06 #2
"John" <Jo**@nospam.infovis.co.uk> wrote in
news:Pq********************@pipex.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.lastname) 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

Jun 14 '06 #3
Problem is not so much to fill all fields but to discourage moving to
another record by mistake by pressing one of the navigation buttons and then
not being able to find the original record or worst overwrite over an
exiting record. We get a lot of temp staff who need to enter their own info
and they tend to make a lot of mistakes hence the need to restrict. However
if the record has been explicitly saved buy the user then it is an
indication that user knows that he/she has finished. In which case they are
allowed to navigate.

Thanks

"Bob Quintal" <rq******@sPAmpatico.ca> wrote in message
news:Xn**********************@66.150.105.47...
"John" <Jo**@nospam.infovis.co.uk> wrote in
news:Pq********************@pipex.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.lastname) 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

Jun 14 '06 #4
In that case, you could put a messagebox in your code in the
BeforeUpdate <?> or the last event that fires in the form before going
to the next record or closes the form. If you don't want to
move/close, set Cancel=True and pop up a messagebox alerting the user.

Jun 14 '06 #5
rkc
John wrote:
Problem is not so much to fill all fields but to discourage moving to
another record by mistake by pressing one of the navigation buttons and then
not being able to find the original record or worst overwrite over an
exiting record.


The safest way is to not allow edit/entry in the same form
that is used to browse records. Enter/edit records in another
form bound to a single record or opened for new entry only.
Jun 14 '06 #6
"John" <Jo**@nospam.infovis.co.uk> wrote in
news:xO******************************@pipex.net:
Problem is not so much to fill all fields but to discourage
moving to another record by mistake by pressing one of the
navigation buttons and then not being able to find the
original record or worst overwrite over an exiting record. We
get a lot of temp staff who need to enter their own info and
they tend to make a lot of mistakes hence the need to
restrict. However if the record has been explicitly saved buy
the user then it is an indication that user knows that he/she
has finished. In which case they are allowed to navigate.

Thanks
My usual design for the user interface involves a continuous
form that's read only, showing the major details of each record.
The form has two buttons, "Add new" and "Edit This". Clicking on
these buttons open single record forms with no navigation
controls. Each has a "Save and Exit" button, and a "Cancel and
Exit" one. Even your average LUSER can figure out operation
easily, and it overcomes the problem you have. I never let the
user edit a record in a continuous form (*), and I do not ever
let them create a new record in a continuous form.

(*)except in very special circumstances, like a form with
checkboxes to select records for further processing.

"Bob Quintal" <rq******@sPAmpatico.ca> wrote in message
news:Xn**********************@66.150.105.47...
"John" <Jo**@nospam.infovis.co.uk> wrote in
news:Pq********************@pipex.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.lastname) 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



--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jun 14 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Danny J. Lesandrini | last post by:
The following code works with a standard MDB to navigate to a particluar record (with a DAO recordset, of course) but it's giving me problems in an ADP I'm working on. Dim rs As ADODB.Recordset...
0
by: Carl | last post by:
I have a main form with navigation buttons on it and a label showing for example Record 1 of 15 using recordsetclone on it and eveything works fine. When I move through the records the record...
15
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any...
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
2
by: BerkshireGuy | last post by:
I am trying to make a custom navigation label to display record Y of X. Dev Ashish's code placed in the OnCurrent Event: Private Sub Form_Current() If Me.NewRecord Then...
1
by: Simon | last post by:
Dear reader, With a combobox I can go to a selected record picked in the pull down list. And in the same time the record navigation field shows the selected record number from the...
4
by: Jamey Shuemaker | last post by:
Howdy, Saw a couple threads from the past few years on this topic, but didn't really find any solutions. Here's one I found:...
0
by: emalcolm_FLA | last post by:
Hello and TIA for your consideration. I have created several db's for a non-profit and they want custom navigation buttons to display "You are on the first record, last record, etc". With this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.