Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make timestamp and userstamp for changed data

Status
Not open for further replies.
Mar 27, 2002
168
NL
I have a form with 4 tabpages in an Access 2002 database]
It's customerrelated information so I need to know who's inside changes the data for the last time.
So 2 fields in the database contains this information
a timestamp and a userstamp
the procedure isn't the problem but how to implement the procedure. When users not change, but only look to information they get a time/userstamp.
I tried the procedures Form_AfterUpdate, Form_Dirty, but it doesn't work.
I think the problem is related to the tabpages, but anyone knows how to solve this?
Thanx,
gerard
 
Gerard,

The tab pages should not effect anything, providing you are not moving between a main form and subforms on the main form.

You should be putting your code to update the the stamp fields on the BeforeUpdate event.

Make sure however, that there is no code behind the form which otherwise automatically updates any bound fields on the form (eg. on the OnCurrent event), otherwise the BeforeUpdate event will be triggered without the user having made any changes.

Hope this helps,
Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Hi Steve,

thnx for ur quick reaction.
Some things not clear to me:
In my opinion the beforeUpdate procedure always is true after leaving a record, so how should I need him?
There are subforms on the tabpages.
In my situation the before/afterUPdate and Dirty doesn't work, so there must be an other way to handle this.

Hope u have other solutions in package ;)

Gerard
 
Gerard,
A couple of fundamentals to understand, and hopefully it will then make sense:

(a) At the form level, the "BeforeUpdate" event is always triggered whenever the following conditions are met:
(i) An attempt is made to move off the current record OR save the current record. AND
(ii) The current record is "dirty"; ie. has "pending changes" which have been made to the record.

(b) Its called "BeforeUpdate", because field level changes, whilst they may be apparent on the form, are only applied back to the database after this BeforeUpdate event has occurred. Once the changes have been written to the database, the dirty property is set to false, and the AfterUpdate event occurs.

(c) The BeforeUpdate event is therefore only triggered if the user has made one or more changes to the current record. It is therefore the place you want to put your stamp handling code.

(d) Where you have subforms on the main form, when you move between them, their respective BeforeUpdate event's will be triggered as you move off the form or subform.

(e) Because the subform has a different recordsource to the main form, you may want to add a different BeforeUpdate event to each form or subform. Whilst subform records may be linked to the main form, they ARE nevertheless separate records, usually in different tables, and may warrant their own stamp fields.

I hope that this helps to clarify things a little. If not, I suggest you create a new test database, with a single table and single form, with a few fields, and experiment with the before update event. Its definately the place to do what you want.

Good luck,
Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top