473,785 Members | 2,235 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5493
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.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

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******@sPAmp atico.ca> wrote in message
news:Xn******** **************@ 66.150.105.47.. .
"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

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.in fovis.co.uk> wrote in
news:xO******** *************** *******@pipex.n et:
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******@sPAmp atico.ca> wrote in message
news:Xn******** **************@ 66.150.105.47.. .
"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



--
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
4229
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 Set rs = Me.RecordsetClone rs.Find "=" & lngContractID If Not rs.EOF Then Me.Bookmark = rs.Bookmark I must site the Heisenberb Uncertainty Principal here, as it
0
8410
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 number changes fine. Within this main form I have a subform detailing distribution records for the contact (main form is based on this) that also has navigation buttons and a label showing Distribution 1 of ##. This is where the problem lies. The...
15
4662
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 field to start. If I edit that field and then click on the new record button in the navigation buttons, the form goes to a new record and each field has the default value of the previous record. If I put the focus in any field to start, edit that...
0
2703
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 form. Then I have 3 pages on a tab control ( 4 if the type of candidate validates that is is to be shown) Each page has a subform. The subforms can be either single or continuous, I think I am still deciding what I want to lock down this entry...
8
12106
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 combobox. What is the solution? Thank you in advance.
2
1854
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 Me!lblNavigate.Caption = "New Record" Else With Me.RecordsetClone
1
4013
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 selection.
4
2906
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: http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/f6ccff0186d12566/ That fella wanted to do pretty well the same thing I did (use a command button to move between records in a form). Moving from record to record
0
1958
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 ng help I've created code for all except the add new record command button. If I create individual sub functions behind each form, no problem. The problem is I am trying to create a re-usable module.
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10350
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.