Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a customer database of names, addresses, etc.
One field is called LastContact. This is a date field which is automatically filled in with the current date **only when the record is first added to the database**.
I often update e.g. the email field of records and then I manually update the LastContact field to the current date, which is quite time consuming when I need to update 120 email-addresses or ordering information fields per week.
Does anyone have a trick how the LastContact field can be automatically updated to the current date when I change any field of that particular record ? With that I mean only that record should be date-updated, not the whole database.
I would reeeeally appreciate "instructions for idiots" because I'm not all that familiar with Access's formulas, macros etc. and would have no idea where to add what. (I do know where the BeforeUpdate and AfterUpdate input lines for the Datum field is though)Many thanks !

In the After Update Event you want to add code like this.
If (IsNull([LastContact]) Or [LastContact] < Date) Then
LastContact = Date
End IfThe After Update event apllies this to the edited record not the whole table.

Many thanks for your help.
Sorry for my ignorance but when I right click on the LastContact field.. Properties.. TextBox:LastContact..Events..
do I simply enter the code directly into the area on the right of the After Update line, or do I need to click the dropdown arrow and select from Expression Builder / Macro Builder / Code Builder ?It doesn't change anything when I enter the code as it is, nor when I use the Code builder and insert the lines between "Private Sub LastContact_AfterUpdate()" and "End Sub".
I've tried editing a record then clicking Save, as well as editing a record then going to the next or previous record, but the LastContact field is still not changing :-(

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |