Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / October 2005

Tip: Looking for answers? Try searching our database.

Afterupdate when and how

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
toine@xs4all.nl - 11 Sep 2005 15:12 GMT
I have a form 'klaarzetten' in which I want to track changes made on
the form.The form contains two subforms.
The table 'Klaarzetten' contains two fields (veranderop-(date),
veranderddoor-(numeric)).  
I want to track changes in the mainform and both the subforms.  Only
the last changes are important to me and I want to register the date
on which the last change is made and the loginname.
I tried to use the forms afterupdate event to write the data in the
table but I got al lot of errors, perhaps because the afterupdate
event is processed when the form close button is pressed?
The event works well when I call it with each control change() event.
But this means that every time a field is changed, the name and date
is written and causes a lot of unwanted data traffic.
What is the best solution to this problem?

 

Al Camp - 11 Sep 2005 15:34 GMT
  Use the BeforeUpdate event of the form/subform to set your date/time
values.
  On my website, I have a small downloadable app that utilizes DOC
(DateOfCreation) and DOLE (DateOfLastEdit).
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

>I have a form 'klaarzetten' in which I want to track changes made on
> the form.The form contains two subforms.
[quoted text clipped - 10 lines]
> is written and causes a lot of unwanted data traffic.
> What is the best solution to this problem?
Allen Browne - 11 Sep 2005 15:37 GMT
Use the BeforeUpdate event of the *form* (not controls).

This is the last moment to write the date and user name before the record is
saved.

There is no point dirtying the record again immediately after the save (as
Form_AfterUpdate does), because you then need to save again, which triggers
the event again, and so you need to save again, and ...

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have a form 'klaarzetten' in which I want to track changes made on
> the form.The form contains two subforms.
[quoted text clipped - 10 lines]
> is written and causes a lot of unwanted data traffic.
> What is the best solution to this problem?
Rhetta75069 - 21 Oct 2005 14:33 GMT
Would this same principle work when you want to track a "Status Change" to a
record?  Can you set it to record the prior status and the date it was
changed?

> Use the BeforeUpdate event of the *form* (not controls).
>
[quoted text clipped - 19 lines]
> > is written and causes a lot of unwanted data traffic.
> > What is the best solution to this problem?
Allen Browne - 22 Oct 2005 15:09 GMT
If you are trying to log changes to another table, then you want to write
them only in Form_AfterUpdate, when you know for sure the change succeeded.
But the OldValue is not available then, so you need to save it somewhere
(variable or temp table) in Form_BeforeUpdate, so you have it in
Form_AfterUpdate.

If you are also trying to record deletions, things get more involved. For
details, see:
   Audit Trail - Log changes at the record level
at:
   http://allenbrowne.com/AppAudit.html

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Would this same principle work when you want to track a "Status Change" to
> a
[quoted text clipped - 27 lines]
>> > is written and causes a lot of unwanted data traffic.
>> > What is the best solution to this problem?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.