473,729 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detect only *manual* change to a form?

To comp.databases. ms.access --

I know that the recommended way to detect an update to a form, is to
use the form's "Before Update" event, and putting in VBA code like:

Private Sub Form_BeforeUpda te(Cancel As Integer)
Me.Last_changed _date = Date
End Sub

Then, the field "Last_changed_d ate" on the form would show the date of
the most recent update.

HOWEVER, in my case this does not work the way I want it to. I have a
field on the form that gets automatically updated, based on the value
of a field in another table. (This is done by a function that is
invoked on the "On Current" event for the form, and the "On Lost Focus"
event for one of the fields in the form.) This has the effect of
setting "Last_changed_d ate" to today *whenever* the form is opened --
which is NOT what I want to do. What I really want to do is update
"Last_changed_d ate" only when the user actually, MANUALLY, keys data
into the form. Does anyone know how I can do this -- hopefully in not
too complicated a manner? Thanks much & happy holidays!

--Tom

Dec 18 '06 #1
4 3404
did you try the Dirty property of the form?

Dec 18 '06 #2
Tom_F wrote:
To comp.databases. ms.access --

I know that the recommended way to detect an update to a form, is to
use the form's "Before Update" event, and putting in VBA code like:

Private Sub Form_BeforeUpda te(Cancel As Integer)
Me.Last_changed _date = Date
End Sub

Then, the field "Last_changed_d ate" on the form would show the date of
the most recent update.

HOWEVER, in my case this does not work the way I want it to. I have a
field on the form that gets automatically updated, based on the value
of a field in another table. (This is done by a function that is
invoked on the "On Current" event for the form, and the "On Lost
Focus" event for one of the fields in the form.) This has the effect
of setting "Last_changed_d ate" to today *whenever* the form is opened
-- which is NOT what I want to do. What I really want to do is update
"Last_changed_d ate" only when the user actually, MANUALLY, keys data
into the form. Does anyone know how I can do this -- hopefully in not
too complicated a manner? Thanks much & happy holidays!

--Tom
The falls into the category of "Doctor, it hurts when I do this".

It is a terrible idea to update a record every time you view it in a form.
Why on earth are you doing that? It sounds you are saving derived data and
updating (correcting) it every time you navigate to each record. If so, the
answer would be to not store such data in the first place.

Eliminate that, then you won't have a problem.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Dec 19 '06 #3
Instead of using the FORM before update, use the Beforeupdate event of
each of the fields that you want to track changes to.

That event is ONLY triggerd on a manual change to the field.

Ron

Dec 19 '06 #4
Mr. Brandt --

Thanks! I followed your suggestion. I left the calculated field on
the form (because the user wants to see this information on the
screen), BUT I changed it from a bound field to an UNBOUND field. Of
course this is better database practice, since a calculated value
stored on a table could well be out of date tomorrow. But I got an
extra "dividend" for my virtue: I can now use the form's "Before
Update" event without a problem! I guess if a field is updated but is
unbound to a table, then it's not considered an "update" -- right?

Before I did the above, I was fooling around with a way to detect a
manual update -- with the calculated field BOUND to the table. It
looks like (as another poster suggested) I could use the "On Dirty"
event. But I believe just one extra wrinkle has to be added: at the
end of the function which calculates my derived value, I put in this
line of VBA code:

Me.Dirty = False

This allows me to subsequently check for a "real" dirty-ing event (i.e.
a manual entry by the user at the keyboard).

Thanks again, everybody -- and Happy Holidays,

--Tom

Rick Brandt wrote:
The falls into the category of "Doctor, it hurts when I do this".

It is a terrible idea to update a record every time you view it in a form.
Why on earth are you doing that? It sounds you are saving derived data and
updating (correcting) it every time you navigate to each record. If so, the
answer would be to not store such data in the first place.

Eliminate that, then you won't have a problem.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Dec 22 '06 #5

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

Similar topics

7
9095
by: Phil Powell | last post by:
How do you detect an image MIME type if you know of the image in a directory? For example, I know of: if (is_file("$myImagePath/$myImageName")) { // FIND MIME TYPE BUT HOW I DUNNO } The only way I could think of was to determine the extension of the
1
2283
by: steve | last post by:
How can I detect in php that I am running from CLI (command line), and not the browser. I hate to put a constant in each script: e.g. define(’CLI’, 1)... -- http://www.dbForumz.com/ This article was posted by author's request Articles individually checked for conformance to usenet standards Topic URL: http://www.dbForumz.com/PHP-auto-detect-CLI-ftopict169501.html Visit Topic URL to contact author (reg. req'd). Report abuse:...
23
6525
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I know if Window.Open has been redefined? BACKGROUND:
1
1285
by: Ludovic Lemarinel | last post by:
Hi, I've got a Tab Control, with a lot of tabs, and a lot of controls in each tab (textboxes, comboboxes, listviews, checkboces, etc...). As these controls are updating a Database, I need to detect if there is any change on any control when closing then form, or on record change . I know which events I should use, but I can't see any property to find if my controls have changes.
2
1931
by: eBob.com | last post by:
I've got the basics of an XML ini file working. I.E. I can stash away and retrieve user preferences. (Code below.) But how do I handle a new preference? Say I have A and B. And then I invent C. The first time the new version with C is run the XML file will not have a value for C. How do I detect that case? Somewhere I got the impression that I could use IsNull, but I was unable to find an example which I could apply to my code. My...
1
7594
by: Steve.Goodman | last post by:
Appologies if this has already been asked, but after scanning the web and this news group I could find no decent solution. We have a windows App that calls a webservice, using this bit of basic code. Dim objPreReq As PDCPreReq.PreReqs Dim objProxy As System.Net.WebProxy = System.Net.WebProxy.GetDefaultProxy objProxy.Credentials = System.Net.CredentialCache.DefaultCredentials
1
1959
by: Gary | last post by:
There are several controls in my form. How to detect currently which control has the forcus and set the forcus to a certain control? Thanks,
3
2839
by: teslar91 | last post by:
I need to display a tiled image in the MDI container form's client area, and also detect right-clicks in that area. How do you do that? So far, I've unsuccessfully tried: 1) Placing my image in the form's BackgroundImage, and creating a MouseUp event for the form. The event never fires. 2) Placing a Picturebox in the Form, docked to fill, and moving my image and MouseUp event to that. Now the event fires, but the Picturebox covers...
2
4183
by: GS | last post by:
How do I properly detect row change before allowing moving to next row? I tried using RowLeave . here is brief descript of the form setup. I have ieStringTmpDataSetwith regex table connected to a SQL mdf., on the form I have a regexDataGridView for the table regex for navigation and viewing purpose only
0
8921
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
8763
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9427
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
8151
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
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();...
1
3238
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
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.