A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date of Change



 
 
Thread Tools Display Modes
  #1  
Old January 23rd, 2005, 09:13 PM
Stig
external usenet poster
 
Posts: n/a
Default Date of Change

Hi
I m still trying to add a field that shows when a record was updated.
I've tried putting Now() in the before update event but i cant get it to
work.
Am I missing something that's obvious?
Thanks for the help
Dave


  #2  
Old January 23rd, 2005, 11:32 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Sun, 23 Jan 2005 21:13:48 -0000, "Stig" wrote:

Hi
I m still trying to add a field that shows when a record was updated.
I've tried putting Now() in the before update event but i cant get it to
work.
Am I missing something that's obvious?
Thanks for the help
Dave


You can't just set the BeforeUpdtae event property to Now() - Access
will have no clue what you are trying to do!

Instead, you will need to put a Date/Time field in your Table, let's
call it DateTimeChanged. Open the Form in design view; view its
Properties; and in the Form's BeforeUpdate event put code like

Private Sub Form_BeforeUpdate(Cancel as Integer)
put any form validation code here
Me!DateTimeChanged = Now
End Sub


John W. Vinson[MVP]
  #3  
Old January 24th, 2005, 12:39 AM
Chris2
external usenet poster
 
Posts: n/a
Default


"Stig" wrote in message
...
Hi
I m still trying to add a field that shows when a record was updated.
I've tried putting Now() in the before update event but i cant get it to
work.
Am I missing something that's obvious?
Thanks for the help
Dave



Make sure that there is a control on the Form for RevisedOn.

In the actual BeforeUpdate field on the Properties Sheet, type "[Event
Procedure]". This causes Access to look for a VBA procedure named
Form_insert event name (see below).

Right-click the form itself in Design View, select Build Event, and in the
Choose Builder dialog box, pick Code Builder (or click on the "Code" button
on the toolbar).

When VBA comes up, it'll have a default event procedure, Load, already
there. Delete it. Then paste the following in:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me.RevisedOn = Now()

End Sub


  #4  
Old January 24th, 2005, 08:55 PM
Brenda@DMS
external usenet poster
 
Posts: n/a
Default



"Chris2" wrote:


"Stig" wrote in message
...
Hi
I m still trying to add a field that shows when a record was updated.
I've tried putting Now() in the before update event but i cant get it to
work.
Am I missing something that's obvious?
Thanks for the help
Dave



Make sure that there is a control on the Form for RevisedOn.

In the actual BeforeUpdate field on the Properties Sheet, type "[Event
Procedure]". This causes Access to look for a VBA procedure named
Form_insert event name (see below).

Right-click the form itself in Design View, select Build Event, and in the
Choose Builder dialog box, pick Code Builder (or click on the "Code" button
on the toolbar).

When VBA comes up, it'll have a default event procedure, Load, already
there. Delete it. Then paste the following in:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me.RevisedOn = Now()

End Sub



There is a very simple solution to your issue.
Create a field (DateUpdated) in the underlying table as a date/time field
and set its default value to Date() or Now(). Then add the field to your
query, form, or report as necessary.

  #5  
Old January 24th, 2005, 09:23 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default

Brenda@DMS wrote:
"Chris2" wrote:

"Stig" wrote in message
...
Hi
I m still trying to add a field that shows when a record was
updated. I've tried putting Now() in the before update event but i

[SNIP]

There is a very simple solution to your issue.
Create a field (DateUpdated) in the underlying table as a date/time
field and set its default value to Date() or Now(). Then add the
field to your query, form, or report as necessary.


That will give you an automatic "CreatedOn" field, but not an automatic
"ChangedOn" field which is what the OP asked for.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dates in a listbox connected to a form... RusCat Using Forms 13 November 25th, 2004 02:31 AM
If I change a date in a date column how do I get the dates below . vpr General Discussion 2 September 9th, 2004 03:58 AM
Aggregating Date Data into Weeks and Quarters Roger Running & Setting Up Queries 3 July 11th, 2004 05:56 PM
cell to change colour at given date - how to Tobit Worksheet Functions 2 September 17th, 2003 12:20 PM


All times are GMT +1. The time now is 06:23 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.