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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
"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
|
|||
|
|||
"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
|
|||
|
|||
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 | |
|
|
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 |