473,698 Members | 2,450 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 3401
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
9093
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
2282
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
6518
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
1283
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
1925
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
7593
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
1958
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
2838
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
4182
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
8675
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
9160
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
9029
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
8897
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
8862
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
7729
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
6521
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
5860
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
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.